Package org.fastnate.data.properties
Class PluralPropertyContents<E>
java.lang.Object
org.fastnate.data.properties.PluralPropertyContents<E>
- Type Parameters:
E- the type of the elements
Wraps the contents of a
PluralProperty to use a common interface during import, independent of the actual
subtype.- Author:
- Tobias Liefke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElement(E element) Adds an element to the end of the collection.static <E,C, V> PluralPropertyContents <V> create(E entity, org.fastnate.generator.context.PluralProperty<E, C, V> property) Creates a wrapper around the contents of the given property in the given entity.abstract voidsetElement(int index, Object key, E element) Sets an element in the collection resp. map.
-
Constructor Details
-
PluralPropertyContents
public PluralPropertyContents()
-
-
Method Details
-
create
public static <E,C, PluralPropertyContents<V> createV> (E entity, org.fastnate.generator.context.PluralProperty<E, C, V> property) Creates a wrapper around the contents of the given property in the given entity. If the current property content is empty, it is initialized with a new empty collection resp. map.- Parameters:
entity- the entity that contains the propertyproperty- the property- Returns:
- the wrapper around the contents of the property for the entity
-
addElement
Adds an element to the end of the collection. Shouldn't be used for maps, as it uses a "null" key- Parameters:
element- the element to add to the end of the collection
-
setElement
Sets an element in the collection resp. map.- Parameters:
index- the index of the added element, if the contents is a listkey- the key of the element, if the contents is a mapelement- the element to add
-