@Override protected void loadModelFromPto(Hero hero, MartialArtsModel model, TraitListPto pto) { for (TraitPto traitPto : pto.traits) { model.selectStyle(new StyleName(traitPto.name)); Trait style = model.getSelectedStyle(); traitPersister.load(style, traitPto); model.learnSelectedStyle(); } }
@Override protected TraitListPto saveModelToPto(MartialArtsModel model) { TraitListPto traitListPto = new TraitListPto(); for (Trait style : model.getLearnedStyles()) { TraitPto traitPto = new TraitPto(); traitPersister.save(style, traitPto); traitListPto.traits.add(traitPto); } return traitListPto; }