Class SimpleTypePartsReader<E extends ModelElement,P extends java.lang.annotation.Annotation,C extends java.lang.annotation.Annotation>
- java.lang.Object
-
- org.faktorips.runtime.model.type.read.SimpleTypePartsReader<E,P,C>
-
public class SimpleTypePartsReader<E extends ModelElement,P extends java.lang.annotation.Annotation,C extends java.lang.annotation.Annotation> extends java.lang.ObjectA simplerTypePartsReaderthat creates it's ownTypePartCollectorfor the case that aModelElementis 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 Classes Modifier and Type Class Description static interfaceSimpleTypePartsReader.ModelElementCreator<T extends ModelElement>Creates a newModelElementunder the given parent element with the given name and getter method.static interfaceSimpleTypePartsReader.NameAccessor<C extends java.lang.annotation.Annotation>Gets the name of the child element from a method annotated with theAnnotationCstatic interfaceSimpleTypePartsReader.NamesAccessor<A extends java.lang.annotation.Annotation>Gets the list of names from the parent class annotated with theAnnotationA
-
Constructor Summary
Constructors Constructor Description SimpleTypePartsReader(java.lang.Class<P> parentAnnotation, SimpleTypePartsReader.NamesAccessor<P> namesAccessor, java.lang.Class<C> childAnnotation, SimpleTypePartsReader.NameAccessor<C> nameAccessor, SimpleTypePartsReader.ModelElementCreator<E> modelElementCreator)
-
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 fromclassWithChildNameList, finds the annotated child elements in theclassWithGetterMethodsand 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.
-
-
-
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 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 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 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.
-
-