/** * Returns non-null if {@link CEnumConstant}s have name collisions among them. * * @return * if there's a collision, return two {@link CEnumConstant}s that collided. * otherwise return null. */ private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) { Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>(); for (CEnumConstant c : memberList) { CEnumConstant old = names.put(c.getName(),c); if(old!=null) // collision detected return new CEnumConstant[]{old,c}; } return null; }
/** * Returns non-null if {@link CEnumConstant}s have name collisions among them. * * @return * if there's a collision, return two {@link CEnumConstant}s that collided. * otherwise return null. */ private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) { Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>(); for (CEnumConstant c : memberList) { CEnumConstant old = names.put(c.getName(),c); if(old!=null) // collision detected return new CEnumConstant[]{old,c}; } return null; }
/** * Returns non-null if {@link CEnumConstant}s have name collisions among them. * * @return * if there's a collision, return two {@link CEnumConstant}s that collided. * otherwise return null. */ private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) { Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>(); for (CEnumConstant c : memberList) { CEnumConstant old = names.put(c.getName(),c); if(old!=null) // collision detected return new CEnumConstant[]{old,c}; } return null; }
/** * Returns non-null if {@link CEnumConstant}s have name collisions among them. * * @return * if there's a collision, return two {@link CEnumConstant}s that collided. * otherwise return null. */ private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) { Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>(); for (CEnumConstant c : memberList) { CEnumConstant old = names.put(c.getName(),c); if(old!=null) // collision detected return new CEnumConstant[]{old,c}; } return null; }
/** * Returns non-null if {@link CEnumConstant}s have name collisions among them. * * @return * if there's a collision, return two {@link CEnumConstant}s that collided. * otherwise return null. */ private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) { Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>(); for (CEnumConstant c : memberList) { CEnumConstant old = names.put(c.getName(),c); if(old!=null) // collision detected return new CEnumConstant[]{old,c}; } return null; }
/** * 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; }
public NamedAvroType avroFromEnum(CEnumLeafInfo info) { List<String> constants = new ArrayList<String>(); for (CEnumConstant constant : info.getConstants()) { constants.add(constant.getName()); } AvroEnum enumType = new AvroEnum(constants); enumType.name = info.shortName; enumType.namespace = makePackageName(info.parent.getOwnerPackage()); return enumType; }
getErrorReporter().error( collision[0].getLocator(), Messages.ERR_ENUM_MEMBER_NAME_COLLISION, collision[0].getName() ); getErrorReporter().error( collision[1].getLocator(), Messages.ERR_ENUM_MEMBER_NAME_COLLISION_RELATED );
getErrorReporter().error( collision[0].getLocator(), Messages.ERR_ENUM_MEMBER_NAME_COLLISION, collision[0].getName() ); getErrorReporter().error( collision[1].getLocator(), Messages.ERR_ENUM_MEMBER_NAME_COLLISION_RELATED );
String constName = mem.getName();
String constName = mem.getName();