T
- The class type of the wrapped bean.public class DelegateBeanMap<T> extends BeanMap<T>
BeanMap
where property values can be overridden, removed, or reordered without
affecting the underlying bean.
Provides the filterKeys(List)
method for specifying the keys to keep in the bean map and in what order
they should appear.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
arrayPropertyCache, bean, meta, propertyCache
Constructor and Description |
---|
DelegateBeanMap(T bean,
BeanSession session)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addKey(String key)
Add a key in the next position.
|
Set<Map.Entry<String,Object>> |
entrySet()
Returns all the properties associated with the bean.
|
DelegateBeanMap<T> |
filterKeys(List<String> keys)
Remove all but the specified properties from this bean map.
|
Object |
get(Object key)
Gets a property on the bean.
|
BeanMeta<T> |
getMeta()
Returns the metadata associated with this bean map.
|
Collection<BeanPropertyMeta> |
getProperties()
Returns a simple collection of properties for this bean map.
|
Set<String> |
keySet()
Returns the names of all properties associated with the bean.
|
Object |
put(String key,
Object val)
Sets a property on the bean.
|
Object |
remove(Object key) |
add, create, getBean, getBean, getBeanSession, getClassMeta, getProperty, getPropertyMeta, getRaw, getValues, load, load, load, resolveVars
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, putAll, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public DelegateBeanMap(T bean, BeanSession session)
bean
- The bean being wrapped.session
- The bean session that created this bean map.public void addKey(String key)
key
- The key to add.public Object put(String key, Object val)
BeanMap
If there is a PojoSwap
associated with this bean property or bean property type class, then you must pass
in a transformed value.
For example, if the bean property type class is a Date
and the bean property has the
TemporalDateSwap.IsoInstant
swap associated with it through the
@Swap(value)
annotation, the value being passed in must be
a String containing an ISO8601 date-time string value.
put
in interface Map<String,Object>
put
in class BeanMap<T>
key
- The name of the property to set.val
- The value to set the property to.beanMapPutReturnsOldValue
is public Object get(Object key)
BeanMap
If there is a PojoSwap
associated with this bean property or bean property type class, then this method
will return the transformed value.
For example, if the bean property type class is a Date
and the bean property has the
TemporalDateSwap.IsoInstant
swap associated with it through the
@Swap(value)
annotation, this method will return a String containing an
ISO8601 date-time string value.
public Set<String> keySet()
BeanMap
The returned set is unmodifiable.
public DelegateBeanMap<T> filterKeys(List<String> keys)
This does not affect the underlying bean.
keys
- The remaining keys in the bean map (in the specified order).public BeanMeta<T> getMeta()
BeanMap
public Set<Map.Entry<String,Object>> entrySet()
BeanMap
public Collection<BeanPropertyMeta> getProperties()
BeanMap
getProperties
in class BeanMap<T>
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.