Class AnnotatedDeclaration

java.lang.Object
org.faktorips.runtime.model.annotation.AnnotatedDeclaration

public class AnnotatedDeclaration extends Object
Helper 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 Details

    • from

      public static AnnotatedDeclaration from(Class<?> generatedClass)
      Creates a new AnnotatedDeclaration from 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 AnnotatedDeclaration for the given generated class
    • is

      public boolean is(Class<? extends Annotation> annotationClass)
      Returns true if this represented type is annotated with the specified annotation class.
      Parameters:
      annotationClass - The annotation class that should be present
      Returns:
      true if the annotation is present else false
    • get

      public <T extends Annotation> T get(Class<T> annotationClass)
      Returns the specified annotation if present. Returns null if 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 List<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 List<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 List<AnnotatedElement> getDeclaredElements()
    • getClassLoader

      public ClassLoader getClassLoader()
      Returns the ClassLoader from the this annotated type. This ClassLoader could be used to load further resources like corresponding property files.
    • getImplementationClass

      public Class<?> getImplementationClass()
      Returns the implementation class of this type.
    • getPublishedInterface

      public Class<?> getPublishedInterface()
      Returns the published interface of this type.
    • getDeclarationClassName

      public String getDeclarationClassName()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object