Class AnnotatedDeclaration
- java.lang.Object
-
- org.faktorips.runtime.model.annotation.AnnotatedDeclaration
-
public class AnnotatedDeclaration extends java.lang.ObjectHelper class that represents a type that was generated by Faktor-IPS with meta data in its annotations. The meta data for a type is split into interface and implementation, sometimes only the implementation class exists. AnnotatedDeclaration allows reading the meta data annotations regardless of which class was annotated in the end.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)static AnnotatedDeclarationfrom(java.lang.Class<?> generatedClass)Creates a newAnnotatedDeclarationfrom the given class.<T extends java.lang.annotation.Annotation>
Tget(java.lang.Class<T> annotationClass)Returns the specified annotation if present.java.lang.ClassLoadergetClassLoader()Returns theClassLoaderfrom the this annotated type.java.lang.StringgetDeclarationClassName()java.util.List<java.lang.reflect.AnnotatedElement>getDeclaredElements()java.util.List<java.lang.reflect.Field>getDeclaredFields()Returns all fields that are declared in this type.java.util.List<java.lang.reflect.Method>getDeclaredMethods()Returns all methods that are declared in this type.java.lang.Class<?>getImplementationClass()Returns the implementation class of this type.java.lang.Class<?>getPublishedInterface()Returns the published interface of this type.inthashCode()booleanis(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Returnstrueif this represented type is annotated with the specified annotation class.
-
-
-
Method Detail
-
from
public static AnnotatedDeclaration from(java.lang.Class<?> generatedClass)
Creates a newAnnotatedDeclarationfrom the given class. The given class is either an implementation or a published interface.- Parameters:
generatedClass- The class that was generated for the model type- Returns:
- An instance of
AnnotatedDeclarationfor the given generated class
-
is
public boolean is(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returnstrueif this represented type is annotated with the specified annotation class.- Parameters:
annotationClass- The annotation class that should be present- Returns:
trueif the annotation is present elsefalse
-
get
public <T extends java.lang.annotation.Annotation> T get(java.lang.Class<T> annotationClass)
Returns the specified annotation if present. Returnsnullif it is not present. Use #is(Class) to check whether the annotation is present or not- Parameters:
annotationClass- The class of the requested annotation- Returns:
- The requested annotation if present else null
-
getDeclaredFields
public java.util.List<java.lang.reflect.Field> getDeclaredFields()
Returns all fields that are declared in this type. That means it collects all fields from the implementation and published interface. If this type represents a product component type it also adds all fields from generations.- Returns:
- A list of fields that are declared in this type
-
getDeclaredMethods
public java.util.List<java.lang.reflect.Method> getDeclaredMethods()
Returns all methods that are declared in this type. That means it collects all methods from the implementation and published interface. If this type represents a product component type it also adds all methods from generations.- Returns:
- A list of fields that are declared in this type
-
getDeclaredElements
public java.util.List<java.lang.reflect.AnnotatedElement> getDeclaredElements()
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Returns theClassLoaderfrom the this annotated type. ThisClassLoadercould be used to load further resources like corresponding property files.
-
getImplementationClass
public java.lang.Class<?> getImplementationClass()
Returns the implementation class of this type.
-
getPublishedInterface
public java.lang.Class<?> getPublishedInterface()
Returns the published interface of this type.
-
getDeclarationClassName
public java.lang.String getDeclarationClassName()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-