public class MapProperty<T, J, K>
- Object
- PropertyBase<Map.Entry<T, J>, K>
- MapProperty
ImplementsIterable<Map.Entry<T, J>>
Base class for a property as a Map which can contain multiple elements within it
Constructors
public MapProperty(String name) | Constructs a property with the given name |
public MapProperty(String name, Class genericTypeKey, Class genericTypeValue) | Constructs a property with the given name |
Methods
public Class getKeyType() | Returns the class for the key element if it’s defined or null if it isn’t |
public Class getValueType() | Returns the class for the value element if it’s defined or null if it isn’t |
public J get(T key) | Gets the property value |
public int size() | The size of the property list |
public K set(T key, J v) | Sets the property value and potentially fires a change event |
public K put(T key, J v) | Same as java.lang.Object) here for coding convention convenience with map code |
public K remove(T key) | Removes the item matching the given key |
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<Map.Entry<T, J>> iterator() | Iterate over the elements of the property |
public Set<T> keySet() | Returns the set of keys in the map property |
public Collection<J> valueSet() | Returns the set of values in the map property |
public Map<T, J> asMap() | Returns a copy of the content as a new map |
public Map<T, Object> asExplodedMap() | Returns a copy of the content as a new map but if the value is a PropertyBusinessObject it will be converted to a Map |
public K setMap(Map<T, J> t) | Sets the entire content of the property |
public void clear() | Remove all the elements from the map |
Inherited methods
Constructor details
MapProperty
public MapProperty(String name)Constructs a property with the given name
Parameters
nameString- the name of the property
MapProperty
public MapProperty(String name, Class genericTypeKey, Class genericTypeValue)Constructs a property with the given name
Parameters
nameString- the name of the property
genericTypeKeyClass- the generic type of the key
genericTypeValueClass- the generic type of the value
Method details
getKeyType
public Class getKeyType()Returns the class for the key element if it’s defined or null if it isn’t
Returns
the class matching the map key
getValueType
public Class getValueType()Returns the class for the value element if it’s defined or null if it isn’t
Returns
the class matching the map value
get
public J get(T key)Gets the property value
Parameters
keyT- the map key
Returns
the property value
size
public int size()The size of the property list
Returns
the number of elements
set
public K set(T key, J v)Sets the property value and potentially fires a change event
Parameters
keyT- the key to set
vJ- the new value
put
public K put(T key, J v)Same as
java.lang.Object) here for coding convention convenience
with map codeParameters
keyT- the key to set
vJ- the new value
remove
public K remove(T key)Removes the item matching the given key
Parameters
keyT- the key
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<Map.Entry<T, J>> iterator()Iterate over the elements of the property
Returns
an iterator
keySet
public Set<T> keySet()Returns the set of keys in the map property
Returns
the keys
valueSet
public Collection<J> valueSet()Returns the set of values in the map property
Returns
the values
asMap
public Map<T, J> asMap()Returns a copy of the content as a new map
Returns
a map
asExplodedMap
public Map<T, Object> asExplodedMap()Returns a copy of the content as a new map but if the value is a PropertyBusinessObject it will
be converted to a Map
Returns
a map
setMap
public K setMap(Map<T, J> t)Sets the entire content of the property
Parameters
tMap<T, J>- the map of elements to set
Returns
the parent object for chaining
clear
public void clear()Remove all the elements from the map