Class AnnotatedDeclaration


  • public class AnnotatedDeclaration
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      static AnnotatedDeclaration from​(java.lang.Class<?> generatedClass)
      Creates a new AnnotatedDeclaration from the given class.
      <T extends java.lang.annotation.Annotation>
      T
      get​(java.lang.Class<T> annotationClass)
      Returns the specified annotation if present.
      java.lang.ClassLoader getClassLoader()
      Returns the ClassLoader from the this annotated type.
      java.lang.String getDeclarationClassName()  
      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.
      int hashCode()  
      boolean is​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
      Returns true if this represented type is annotated with the specified annotation class.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • from

        public static AnnotatedDeclaration from​(java.lang.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​(java.lang.Class<? extends java.lang.annotation.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 java.lang.annotation.Annotation> T get​(java.lang.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 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 the ClassLoader from the this annotated type. This ClassLoader could 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:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object