public class ListProperty<T, K>

  1. Object
  2. PropertyBase<T, K>
  3. CollectionProperty<T, K>
  4. ListProperty

ImplementsIterable<T>

Base class for a property as a list which can contain multiple elements within

Constructors

public ListProperty(String name, T... values)Constructs a property with the given name and value
public ListProperty(String name, Class<T> elementType, T... values)Constructs a property with the given name and values by specifying the type of the elements explicitly.
public ListProperty(String name)Constructs a property with null value

Methods

public T get(int offset)Gets the property value
public int size()The size of the property list
public K set(int offset, T v)Sets the property value and potentially fires a change event
public K set(Collection<T> t)Sets the entire content of the property
public K setList(Collection<T> t)Historical alias of set(Collection t) Sets the entire content of the property
public K add(int offset, T v)Adds a property value and fires a change event
public K add(T v)Adds a property value to the end of the list and fires a change event
public K addAll(Collection<? extends T> v)Adds a all properties value to the list and fires a change event
public K remove(int offset)Removes the item at the given offset
public K remove(T v)Removes the item with this value
public K removeAll(Collection<? extends T> v)Removes from the list all values from the given collection and fires a change event if the list has changed
public boolean equals(Object obj)Compares this property to another property
public int hashCode()Returns the internal hashcode or 0 for null property
public Iterator<T> iterator()Iterate over the elements of the property
public List<T> asList()Returns a copy of the content as a new list
public List<Object> asExplodedList()Returns a copy of the content as a new list but if the value is a PropertyBusinessObject it will be converted to a Map
public void clear()Remove all the elements from the list
public boolean contains(T element)Returns true if the given element is contained in the list property
public int indexOf(T element)Returns the index of the given element in the list property

Inherited methods

Constructor details

ListProperty

public ListProperty(String name, T... values)
Constructs a property with the given name and value

Parameters

name String
the name of the property
values T...
default values for the property

ListProperty

public ListProperty(String name, Class<T> elementType, T... values)
Constructs a property with the given name and values by specifying the type of the elements explicitly. The element type needs to be specified if the list should contain PropertyBusinessObjects and needs to get deserialized properly!

Parameters

name String
the name of the property
elementType Class<T>
subclass of PropertyBusinessObject
values T...
default values for the property

ListProperty

public ListProperty(String name)
Constructs a property with null value

Parameters

name String
the name of the property

Method details

get

public T get(int offset)
Gets the property value

Parameters

offset int
the offset within the list

Returns

the property value

size

public int size()
The size of the property list

Returns

the number of elements

set

public K set(int offset, T v)
Sets the property value and potentially fires a change event

Parameters

offset int
the position for the new value
v T
the new value

Returns

the parent object for chaining

set

public K set(Collection<T> t)
Sets the entire content of the property

Parameters

t Collection<T>
the collection of elements to set

Returns

the parent object for chaining

setList

public K setList(Collection<T> t)
Historical alias of set(Collection t) Sets the entire content of the property

Parameters

t Collection<T>
the collection of elements to set

Returns

the parent object for chaining

add

public K add(int offset, T v)
Adds a property value and fires a change event

Parameters

offset int
the position for the new value
v T
the new value

add

public K add(T v)
Adds a property value to the end of the list and fires a change event

Parameters

v T
the new value

addAll

public K addAll(Collection<? extends T> v)
Adds a all properties value to the list and fires a change event

Parameters

v Collection<? extends T>
the collection of values to add

remove

public K remove(int offset)
Removes the item at the given offset

Parameters

offset int
the offset

remove

public K remove(T v)
Removes the item with this value

Parameters

v T
the value object

removeAll

public K removeAll(Collection<? extends T> v)
Removes from the list all values from the given collection and fires a change event if the list has changed

Parameters

v Collection<? extends T>
the collection of values to remove

equals

public boolean equals(Object obj)
Compares this property to another property

Parameters

obj Object
the other property

Returns

true if they are equal in name and value

hashCode

public int hashCode()
Returns the internal hashcode or 0 for null property

Returns

the hashcode value

iterator

public Iterator<T> iterator()
Iterate over the elements of the property

Returns

an iterator

asList

public List<T> asList()
Returns a copy of the content as a new list

Returns

a list

asExplodedList

public List<Object> asExplodedList()
Returns a copy of the content as a new list but if the value is a PropertyBusinessObject it will be converted to a Map

Returns

a list

clear

public void clear()
Remove all the elements from the list

contains

public boolean contains(T element)
Returns true if the given element is contained in the list property

Parameters

element T
the element

Returns

true if the given element is contained in the list property

indexOf

public int indexOf(T element)
Returns the index of the given element in the list property

Parameters

element T
the element

Returns

the index of the given element in the list property