public class MapProperty<T, J, K>

  1. Object
  2. PropertyBase<Map.Entry<T, J>, K>
  3. 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

name String
the name of the property

MapProperty

public MapProperty(String name, Class genericTypeKey, Class genericTypeValue)
Constructs a property with the given name

Parameters

name String
the name of the property
genericTypeKey Class
the generic type of the key
genericTypeValue Class
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

key T
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

key T
the key to set
v J
the new value

put

public K put(T key, J v)
Same as java.lang.Object) here for coding convention convenience with map code

Parameters

key T
the key to set
v J
the new value

remove

public K remove(T key)
Removes the item matching the given key

Parameters

key T
the key

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<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

t Map<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