Java Code Examples for org.eclipse.xtext.common.types.JvmEnumerationType#setPackageName()
The following examples show how to use
org.eclipse.xtext.common.types.JvmEnumerationType#setPackageName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReflectionTypeFactory.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected JvmEnumerationType createEnumerationType(Class<?> clazz) { JvmEnumerationType result = TypesFactory.eINSTANCE.createJvmEnumerationType(); result.internalSetIdentifier(clazz.getName()); result.setSimpleName(clazz.getSimpleName()); if (clazz.getDeclaringClass() == null && clazz.getPackage() != null) result.setPackageName(clazz.getPackage().getName()); setVisibility(clazz, result); setTypeModifiers(clazz, result); createNestedTypes(clazz, result); createMethods(clazz, result); createFields(clazz, result); createConstructors(clazz, result); setSuperTypes(clazz, result); createAnnotationValues(clazz, result); return result; }
Example 2
Source File: JvmTypesBuilder.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
/** * 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); }