public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
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; }
private JExpression getEnumLeafInfoCopyExpression( final FieldOutline fieldOutline, final CEnumLeafInfo type, final JBlock block, final JExpression sourceExpr ) { block.directStatement( "// CEnumLeafInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return sourceExpr; }