@Override public void registerEnumerationType(final String qualifiedName) throws IllegalArgumentException { final JvmEnumerationType newType = TypesFactory.eINSTANCE.createJvmEnumerationType(); newType.setVisibility(JvmVisibility.PUBLIC); this.setNameAndAccept(newType, qualifiedName); }
protected void initialize(XtendEnum source, JvmEnumerationType inferredJvmType) { inferredJvmType.setVisibility(source.getVisibility()); inferredJvmType.setStatic(source.isStatic() && !isTopLevel(source)); translateAnnotationsTo(source.getAnnotations(), inferredJvmType); for (XtendMember member : source.getMembers()) { if (member instanceof XtendEnumLiteral) transform((XtendEnumLiteral) member, inferredJvmType); } jvmTypesBuilder.copyDocumentationTo(source, inferredJvmType); }
/** * Creates a public enum declaration, associated to the given sourceElement. It sets the given name, which might be * fully qualified using the standard Java notation. * * @param sourceElement * the sourceElement the resulting element is associated with. * @param name * the qualified name of the resulting enum type. * @param initializer * the initializer to apply on the created enumeration type. If <code>null</code>, the enum won't be initialized. * * @return a result representing a Java enum type with the given name, <code>null</code> * if sourceElement or name are <code>null</code>. */ /* @Nullable */ public JvmEnumerationType toEnumerationType(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name, /* @Nullable */ Procedure1<? super JvmEnumerationType> initializer) { if (sourceElement == null || name == null) return null; Pair<String, String> fullName = splitQualifiedName(name); JvmEnumerationType result = typesFactory.createJvmEnumerationType(); result.setSimpleName(fullName.getSecond()); result.setVisibility(JvmVisibility.PUBLIC); if (fullName.getFirst() != null) result.setPackageName(fullName.getFirst()); associate(sourceElement, result); return initializeSafely(result, initializer); }