Class PluralPropertyContents<E>

java.lang.Object
org.fastnate.data.properties.PluralPropertyContents<E>
Type Parameters:
E - the type of the elements

public abstract class PluralPropertyContents<E> extends Object
Wraps the contents of a PluralProperty to use a common interface during import, independent of the actual subtype.
Author:
Tobias Liefke
  • Constructor Details

    • PluralPropertyContents

      public PluralPropertyContents()
  • Method Details

    • create

      public 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. If the current property content is empty, it is initialized with a new empty collection resp. map.
      Parameters:
      entity - the entity that contains the property
      property - the property
      Returns:
      the wrapper around the contents of the property for the entity
    • addElement

      public void addElement(E element)
      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

      public abstract void setElement(int index, Object key, E element)
      Sets an element in the collection resp. map.
      Parameters:
      index - the index of the added element, if the contents is a list
      key - the key of the element, if the contents is a map
      element - the element to add