Class SimpleTypePartsReader<E extends ModelElement,​P extends java.lang.annotation.Annotation,​C extends java.lang.annotation.Annotation>


  • public class SimpleTypePartsReader<E extends ModelElement,​P extends java.lang.annotation.Annotation,​C extends java.lang.annotation.Annotation>
    extends java.lang.Object
    A simpler TypePartsReader that creates it's own TypePartCollector for the case that a ModelElement is defined with annotations on a single getter method and all child elements are listed in an annotation on their parent element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.LinkedHashMap<java.lang.String,​E> createParts​(java.lang.Class<?> classWithChildNameList, java.lang.Class<?> classWithGetterMethods, ModelElement parentModel)
      Reads the names of all child elements from classWithChildNameList, finds the annotated child elements in the classWithGetterMethods and creates new parts referencing their parent model.
      java.util.LinkedHashMap<java.lang.String,​E> createParts​(java.lang.Class<?> annotatedClass, ModelElement parentModel)
      Reads the names of all child elements from the annotated class, finds the annotated child elements and creates new parts referencing their parent model.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleTypePartsReader

        public SimpleTypePartsReader​(java.lang.Class<P> parentAnnotation,
                                     SimpleTypePartsReader.NamesAccessor<P> namesAccessor,
                                     java.lang.Class<C> childAnnotation,
                                     SimpleTypePartsReader.NameAccessor<C> nameAccessor,
                                     SimpleTypePartsReader.ModelElementCreator<E> modelElementCreator)
        Parameters:
        parentAnnotation - the type of annotation on the parent class
        namesAccessor - used to get the list of names from the parent class annotated with the parentAnnotation
        childAnnotation - the type of annotation identifying a child element
        nameAccessor - used to get the name of the child element from a method annotated with the childAnnotation
        modelElementCreator - used to create a new ModelElement with the name returned by the nameAccessor and a reference to the method annotated with the childAnnotation
    • Method Detail

      • createParts

        public java.util.LinkedHashMap<java.lang.String,​E> createParts​(java.lang.Class<?> annotatedClass,
                                                                             ModelElement parentModel)
        Reads the names of all child elements from the annotated class, finds the annotated child elements and creates new parts referencing their parent model.
        Returns:
        a map of all child elements referenced by their name in the order defined in the annotated class.
      • createParts

        public java.util.LinkedHashMap<java.lang.String,​E> createParts​(java.lang.Class<?> classWithChildNameList,
                                                                             java.lang.Class<?> classWithGetterMethods,
                                                                             ModelElement parentModel)
        Reads the names of all child elements from classWithChildNameList, finds the annotated child elements in the classWithGetterMethods and creates new parts referencing their parent model.
        Returns:
        a map of all child elements referenced by their name in the order defined in the classWithChildNameList.