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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCreates a newModelElementunder the given parent element with the given name and getter method.static interfaceGets the name of the child element from a method annotated with theAnnotationCstatic interfaceGets the list of names from the parent class annotated with theAnnotationA -
Constructor Summary
ConstructorsConstructorDescriptionSimpleTypePartsReader(Class<P> parentAnnotation, SimpleTypePartsReader.NamesAccessor<P> namesAccessor, Class<C> childAnnotation, SimpleTypePartsReader.NameAccessor<C> nameAccessor, SimpleTypePartsReader.ModelElementCreator<E> modelElementCreator) -
Method Summary
Modifier and TypeMethodDescriptioncreateParts(Class<?> classWithChildNameList, Class<?> classWithGetterMethods, ModelElement parentModel) Reads the names of all child elements fromclassWithChildNameList, finds the annotated child elements in theclassWithGetterMethodsand creates new parts referencing their parent model.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.
-
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 classnamesAccessor- used to get the list of names from the parent class annotated with theparentAnnotationchildAnnotation- the type of annotation identifying a child elementnameAccessor- used to get the name of the child element from a method annotated with thechildAnnotationmodelElementCreator- used to create a newModelElementwith the name returned by thenameAccessorand a reference to the method annotated with thechildAnnotation
-
-
Method Details
-
createParts
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 fromclassWithChildNameList, finds the annotated child elements in theclassWithGetterMethodsand 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.
-