*/
public static void addMissingEnumerationMembers(Enumeration enumeration) {
//add the values
String valuesMethodName = "values";
Method valuesMethod = enumeration.getContainedMethod(valuesMethodName);
if (valuesMethod == null) {
valuesMethod = MembersFactory.eINSTANCE.createInterfaceMethod();
valuesMethod.setName(valuesMethodName);
ClassifierReference type = TypesFactory.eINSTANCE.createClassifierReference();
type.setTarget(enumeration);
valuesMethod.setTypeReference(type);
enumeration.getDefaultMembers().add(valuesMethod);
}
//add the value of method
String valueOfMethodName = "valueOf";
Method valueOfMethod = enumeration.getContainedMethod(valueOfMethodName);
if (valueOfMethod == null) {
valueOfMethod = MembersFactory.eINSTANCE.createInterfaceMethod();
valueOfMethod.setName(valueOfMethodName);
ClassifierReference type = TypesFactory.eINSTANCE.createClassifierReference();
type.setTarget(enumeration);
valueOfMethod.setTypeReference(type);
Parameter strParameter = ParametersFactory.eINSTANCE.createOrdinaryParameter();
strParameter.setName("str");
type = TypesFactory.eINSTANCE.createClassifierReference();
type.setTarget(enumeration.getConcreteClassifier("java.lang.String"));
strParameter.setTypeReference(type);
valueOfMethod.getParameters().add(strParameter);
enumeration.getDefaultMembers().add(valueOfMethod);
}
}