Class SimpleTypePartsReader<E extends ModelElement,P extends Annotation,C extends Annotation>

java.lang.Object
org.faktorips.runtime.model.type.read.SimpleTypePartsReader<E,P,C>

public class SimpleTypePartsReader<E extends ModelElement,P extends Annotation,C extends Annotation> extends 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.
  • Constructor Details

    • SimpleTypePartsReader

      public SimpleTypePartsReader(Class<P> parentAnnotation, SimpleTypePartsReader.NamesAccessor<P> namesAccessor, 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 Details

    • createParts

      public LinkedHashMap<String,E> createParts(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 LinkedHashMap<String,E> createParts(Class<?> classWithChildNameList, 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.