public class SimpleTypePartsReader<E extends ModelElement,P extends Annotation,C extends Annotation> extends Object
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.| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleTypePartsReader.ModelElementCreator<T extends ModelElement>
Creates a new
ModelElement under the given parent element with the given name and
getter method. |
static interface |
SimpleTypePartsReader.NameAccessor<C extends Annotation>
Gets the name of the child element from a method annotated with the
Annotation
C |
static interface |
SimpleTypePartsReader.NamesAccessor<A extends Annotation>
Gets the list of names from the parent class annotated with the
Annotation A |
| Constructor and Description |
|---|
SimpleTypePartsReader(Class<P> parentAnnotation,
SimpleTypePartsReader.NamesAccessor<P> namesAccessor,
Class<C> childAnnotation,
SimpleTypePartsReader.NameAccessor<C> nameAccessor,
SimpleTypePartsReader.ModelElementCreator<E> modelElementCreator) |
| Modifier and Type | Method and Description |
|---|---|
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. |
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.
|
public SimpleTypePartsReader(Class<P> parentAnnotation, SimpleTypePartsReader.NamesAccessor<P> namesAccessor, Class<C> childAnnotation, SimpleTypePartsReader.NameAccessor<C> nameAccessor, SimpleTypePartsReader.ModelElementCreator<E> modelElementCreator)
parentAnnotation - the type of annotation on the parent classnamesAccessor - used to get the list of names from the parent class annotated with the
parentAnnotationchildAnnotation - the type of annotation identifying a child elementnameAccessor - used to get the name of the child element from a method annotated with
the childAnnotationmodelElementCreator - used to create a new ModelElement with the name returned
by the nameAccessor and a reference to the method annotated with the
childAnnotationpublic LinkedHashMap<String,E> createParts(Class<?> annotatedClass, ModelElement parentModel)
public LinkedHashMap<String,E> createParts(Class<?> classWithChildNameList, Class<?> classWithGetterMethods, ModelElement parentModel)
classWithChildNameList, finds the
annotated child elements in the classWithGetterMethods and creates new parts
referencing their parent model.classWithChildNameList.Copyright © 2016. All rights reserved.