/** * The spec says the value field in the enum class will be generated * only under certain circumstances. * * @return * true if the generated enum class should have the value field. */ public boolean needsValueField() { for (CEnumConstant cec : members) { if(!cec.getName().equals(cec.getLexicalValue())) return true; } return false; }
/** * The spec says the value field in the enum class will be generated * only under certain circumstances. * * @return * true if the generated enum class should have the value field. */ public boolean needsValueField() { for (CEnumConstant cec : members) { if(!cec.getName().equals(cec.getLexicalValue())) return true; } return false; }
/** * The spec says the value field in the enum class will be generated * only under certain circumstances. * * @return * true if the generated enum class should have the value field. */ public boolean needsValueField() { for (CEnumConstant cec : members) { if(!cec.getName().equals(cec.getLexicalValue())) return true; } return false; }
/** * The spec says the value field in the enum class will be generated * only under certain circumstances. * * @return * true if the generated enum class should have the value field. */ public boolean needsValueField() { for (CEnumConstant cec : members) { if(!cec.getName().equals(cec.getLexicalValue())) return true; } return false; }
/** * The spec says the value field in the enum class will be generated * only under certain circumstances. * * @return * true if the generated enum class should have the value field. */ public boolean needsValueField() { for (CEnumConstant cec : members) { if(!cec.getName().equals(cec.getLexicalValue())) return true; } return false; }
public JExpression createConstant(Outline outline, XmlString literal) { // correctly identifying which constant it maps to is hard, so // here I'm cheating JClass type = toType(outline,Aspect.EXPOSED); for (CEnumConstant mem : members) { if(mem.getLexicalValue().equals(literal.value)) return type.staticRef(mem.getName()); } return null; }
public JExpression createConstant(Outline outline, XmlString literal) { // correctly identifying which constant it maps to is hard, so // here I'm cheating JClass type = toType(outline,Aspect.EXPOSED); for (CEnumConstant mem : members) { if(mem.getLexicalValue().equals(literal.value)) return type.staticRef(mem.getName()); } return null; }
public JExpression createConstant(Outline outline, XmlString literal) { // correctly identifying which constant it maps to is hard, so // here I'm cheating JClass type = toType(outline,Aspect.EXPOSED); for (CEnumConstant mem : members) { if(mem.getLexicalValue().equals(literal.value)) return type.staticRef(mem.getName()); } return null; }
public JExpression createConstant(Outline outline, XmlString literal) { // correctly identifying which constant it maps to is hard, so // here I'm cheating JClass type = toType(outline,Aspect.EXPOSED); for (CEnumConstant mem : members) { if(mem.getLexicalValue().equals(literal.value)) return type.staticRef(mem.getName()); } return null; }
public JExpression createConstant(Outline outline, XmlString literal) { // correctly identifying which constant it maps to is hard, so // here I'm cheating JClass type = toType(outline,Aspect.EXPOSED); for (CEnumConstant mem : members) { if(mem.getLexicalValue().equals(literal.value)) return type.staticRef(mem.getName()); } return null; }
/** * Retrieve the enum constant that correlates to the string value. * @param enumType Type identifying an Enum in the code model * @param enumStringValue Lexical value of the constant to search * @param outline Outline of the code model * @return The matching Constant from the enum type or NULL if not found */ private JEnumConstant findEnumConstant(JType enumType, String enumStringValue, Outline outline) { // Search all Enums generated for (EnumOutline eo : outline.getEnums()) { // Is it the type of my variable? if (eo.clazz == enumType) { // Search all Constants of that enum for (EnumConstantOutline eco : eo.constants) { // Is the enum generated from the XML defaut value string? if (eco.target.getLexicalValue().equals(enumStringValue)) { return eco.constRef; } } // for Constants // Did not find the constant??? System.out.println("[WARN] Could not find EnumConstant for value: "+enumStringValue); return null; } } // Did not find the type?? System.out.println("[WARN] Could not find Enum class for type: "+enumType.fullName()); return null; }
.param("value", enumConstantOutline.target.getLexicalValue());
Messages.ERR_UNUSABLE_NAME.format(mem.getLexicalValue(), constName ) ); constRef.arg(e.base.createConstant(this, new XmlString(mem.getLexicalValue()))); if(!mem.getLexicalValue().equals(constName)) constRef.annotate2(XmlEnumValueWriter.class).value(mem.getLexicalValue());
Messages.ERR_UNUSABLE_NAME.format(mem.getLexicalValue(), constName ) ); constRef.arg(e.base.createConstant(this, new XmlString(mem.getLexicalValue()))); if(!mem.getLexicalValue().equals(constName)) constRef.annotate2(XmlEnumValueWriter.class).value(mem.getLexicalValue());
Messages.ERR_UNUSABLE_NAME.format(mem.getLexicalValue(), constName)); constRef.arg(e.base.createConstant(this, new XmlString(mem.getLexicalValue()))); if (!mem.getLexicalValue().equals(constName)) { constRef.annotate2(XmlEnumValueWriter.class).value(mem.getLexicalValue());
Messages.ERR_UNUSABLE_NAME.format(mem.getLexicalValue(), constName)); constRef.arg(e.base.createConstant(this, new XmlString(mem.getLexicalValue()))); if (!mem.getLexicalValue().equals(constName)) { constRef.annotate2(XmlEnumValueWriter.class).value(mem.getLexicalValue());
Messages.ERR_UNUSABLE_NAME.format(mem.getLexicalValue(), constName)); constRef.arg(e.base.createConstant(this, new XmlString(mem.getLexicalValue()))); if (!mem.getLexicalValue().equals(constName)) { constRef.annotate2(XmlEnumValueWriter.class).value(mem.getLexicalValue());