/** * Creates a public annotation 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 class. * @param initializer * the initializer to apply on the created annotation. If <code>null</code>, the annotation won't be initialized. * * @return a {@link JvmAnnotationType} representing a Java annotation of the given name, <code>null</code> * if sourceElement or name are <code>null</code>. */ /* @Nullable */ public JvmAnnotationType toAnnotationType(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name, /* @Nullable */ Procedure1<? super JvmAnnotationType> initializer) { if (sourceElement == null || name == null) return null; Pair<String, String> fullName = splitQualifiedName(name); JvmAnnotationType annotationType = typesFactory.createJvmAnnotationType(); annotationType.setSimpleName(fullName.getSecond()); annotationType.setAbstract(true); if (fullName.getFirst() != null) annotationType.setPackageName(fullName.getFirst()); associate(sourceElement, annotationType); return initializeSafely(annotationType, initializer); }
protected void initialize(XtendAnnotationType source, JvmAnnotationType inferredJvmType) { inferredJvmType.setVisibility(source.getVisibility()); inferredJvmType.setStatic(source.isStatic() && !isTopLevel(source)); inferredJvmType.setAbstract(true); translateAnnotationsTo(source.getAnnotations(), inferredJvmType); jvmTypesBuilder.copyDocumentationTo(source, inferredJvmType);