public class SetProperty<T, K>
ImplementsIterable<T>
Base class for a property as a set which can contain multiple elements within
Constructors
public SetProperty(String name, T... values) | Constructs a property with the given name and value |
public SetProperty(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 SetProperty(String name) | Constructs a property with null value |
Methods
public int size() | The size of the property set |
public K set(Collection<T> t) | Sets the entire content of the property |
public K add(T v) | Adds a property value to the set and fires a change event if it changed the set |
public K addAll(Collection<? extends T> v) | Adds a collection of values to the set and fires a change event if it changed the set |
public K remove(T v) | Removes the given item from the set and fires a change event if this item has been successfully removed |
public K remove(int v) | Removes the given item from the set and fires a change event if this item has been successfully removed |
public K removeAll(Collection<? extends T> v) | Removes from the set all values from the given collection and fires a change event if the set 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 set and fires a change event if the set wasn’t empty |
public boolean contains(T element) | Returns true if the given element is contained in the set property |
Inherited methods
Constructor details
SetProperty
public SetProperty(String name, T... values)Constructs a property with the given name and value
Parameters
nameString- the name of the property
valuesT...- default values for the property
SetProperty
public SetProperty(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 set should contain
PropertyBusinessObjects and needs
to get deserialized properly!Parameters
nameString- the name of the property
elementTypeClass<T>- subclass of
PropertyBusinessObject valuesT...- default values for the property
SetProperty
public SetProperty(String name)Constructs a property with null value
Parameters
nameString- the name of the property
Method details
size
public int size()The size of the property set
Returns
the number of elements
set
public K set(Collection<T> t)Sets the entire content of the property
Parameters
tCollection<T>- the collection of elements to set
Returns
the parent object for chaining
add
public K add(T v)Adds a property value to the set and fires a change event if it changed the set
Parameters
vT- the new value
addAll
public K addAll(Collection<? extends T> v)Adds a collection of values to the set and fires a change event if it changed the set
Parameters
vCollection<? extends T>- the new value
remove
public K remove(T v)Removes the given item from the set and fires a change event if this item has been successfully removed
Parameters
vT- the item to remove
remove
public K remove(int v)Removes the given item from the set and fires a change event if this item has been successfully removed
Parameters
vint- the item to remove
removeAll
public K removeAll(Collection<? extends T> v)Removes from the set all values from the given collection and fires a change event if the set has changed
Parameters
vCollection<? extends T>- the collection of values to remove
equals
public boolean equals(Object obj)Compares this property to another property
Parameters
objObject- 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 set and fires a change event if the set wasn’t empty
contains
public boolean contains(T element)Returns true if the given element is contained in the set property
Parameters
elementT- the element
Returns
true if the given element is contained in the set property