@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @Override public GenericCharacterTemplate clone() { GenericCharacterTemplate clone; try { clone = (GenericCharacterTemplate) super.clone(); } catch (CloneNotSupportedException e) { throw new UnreachableCodeReachedException(e); } if (bonusPointCosts != null) { clone.bonusPointCosts = bonusPointCosts.clone(); } if (creationPoints != null) { clone.creationPoints = creationPoints.clone(); } if (experienceCosts != null) { clone.experienceCosts = experienceCosts.clone(); } return clone; }
private void setCreationPoints( GenericCharacterTemplate characterTemplate, Element creationElement) throws PersistenceException { Element creationPointsElement = creationElement.element(TAG_CREATION_POINTS); if (creationPointsElement == null) { return; } CreationPointTemplateParser parser = createCreationPointTemplateParser(); GenericCreationPoints creationPoints = parser.parseTemplate(creationPointsElement); characterTemplate.setCreationPoints(creationPoints); }
private void setBonusPoints(GenericCharacterTemplate characterTemplate, Element creationElement) throws PersistenceException { Element bonusPointsElement = creationElement.element("bonusPointCosts"); if (bonusPointsElement == null) { return; } BonusPointCostTemplateParser parser = new BonusPointCostTemplateParser(registryCollection.getBonusPointTemplateRegistry()); GenericBonusPointCosts bonusPoints = parser.parseTemplate(bonusPointsElement); characterTemplate.setBonusPointCosts(bonusPoints); }
private void parseModels(Element element, GenericCharacterTemplate characterTemplate) throws PersistenceException { Element modelsElement = element.element("models"); if (modelsElement == null) { return; } for (Object modelElement : modelsElement.elements()) { String modelId = ((Element) modelElement).attributeValue("id"); String modelTemplateId = ((Element) modelElement).attributeValue("template"); characterTemplate.addModel(modelId, modelTemplateId); } }
private void setExperiencePoints( GenericCharacterTemplate characterTemplate, Element experienceElement) throws PersistenceException { Element experiencePointsElement = experienceElement.element(TAG_EXPERIENCE_POINT_COST); if (experiencePointsElement == null) { return; } ExperienceTemplateParser parser = new ExperienceTemplateParser(registryCollection.getExperienceTemplateRegistry()); GenericExperiencePointCosts experienceTemplate = parser.parseTemplate(experiencePointsElement); characterTemplate.setExperiencePointCosts(experienceTemplate); }
private void updateTemplateType(Element element, GenericCharacterTemplate characterTemplate) throws PersistenceException { TemplateType templateType = new TemplateTypeParser(characterTypes).parse(element); characterTemplate.setTemplateType(templateType); }