public abstract class BasePropertySet extends Object implements PropertySet
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
BasePropertySet.Accessor
Represents a typed property defined on a
PropertySet. |
protected static class |
BasePropertySet.PropertyMap
Represents the list of strongly-typed known properties
(keyed by property names.)
|
static class |
BasePropertySet.PropertyMapEntry
PropertyMapEntry represents a Map.Entry in the PropertyMap with more efficient access.
|
PropertySet.Property| Modifier | Constructor and Description |
|---|---|
protected |
BasePropertySet()
Creates a new instance of TypedMap.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
asMap()
Creates a modifiable
Map view of this PropertySet. |
boolean |
containsKey(Object key) |
protected void |
createEntrySet(Set<Map.Entry<String,Object>> core) |
Map<String,Object> |
createMapView()
Deprecated.
use newer implementation
PropertySet.asMap() which produces
readwrite Map |
protected Map<String,Object> |
createView() |
Object |
get(Object key)
Gets the name of the property.
|
protected abstract BasePropertySet.PropertyMap |
getPropertyMap()
Map representing the Fields and Methods annotated with
PropertySet.Property. |
protected boolean |
mapAllowsAdditionalProperties()
Used when constructing the
MapView for this object - it controls if the MapView servers only to
access strongly typed values or allows also different values |
protected static BasePropertySet.PropertyMap |
parse(Class clazz)
This method parses a class for fields and methods with
PropertySet.Property. |
Object |
put(String key,
Object value)
Sets a property.
|
Object |
remove(Object key) |
boolean |
supports(Object key)
Checks if this
PropertySet supports a property of the given name. |
protected abstract BasePropertySet.PropertyMap getPropertyMap()
PropertySet.Property.
Model of PropertySet class.
At the end of the derivation chain this method just needs to be implemented as:
private static final PropertyMap model;
static {
model = parse(MyDerivedClass.class);
}
protected PropertyMap getPropertyMap() {
return model;
}
protected static BasePropertySet.PropertyMap parse(Class clazz)
PropertySet.Property.public boolean containsKey(Object key)
containsKey in interface PropertySetpublic Object get(Object key)
get in interface PropertySetkey - This field is typed as Object to follow the Map.get(Object)
convention, but if anything but String is passed, this method
just returns null.public Object put(String key, Object value)
put in interface PropertySetReadOnlyPropertyException - if the given key is an alias of a strongly-typed field,
and if the name object given is not assignable to the field.Propertypublic boolean supports(Object key)
PropertySet supports a property of the given name.supports in interface PropertySetpublic Object remove(Object key)
remove in interface PropertySet@Deprecated public final Map<String,Object> createMapView()
PropertySet.asMap() which produces
readwrite MapMap view of this PropertySet.
This map is partially live, in the sense that values you set to it
will be reflected to PropertySet.
However, this map may not pick up changes made
to PropertySet after the view is created.
createMapView in interface PropertySetpublic Map<String,Object> asMap()
Map view of this PropertySet.
Changes done on this Map or on PropertySet object work in both directions - values made to
Map are reflected to PropertySet and changes done using getters/setters on PropertySet
object are automatically reflected in this Map.
If necessary, it also can hold other values (not present on PropertySet) -
PropertySet#mapAllowsAdditionalPropertiesasMap in interface PropertySetprotected boolean mapAllowsAdditionalProperties()
MapView for this object - it controls if the MapView servers only to
access strongly typed values or allows also different valuesMap should allow also properties not defined as strongly typed fieldsCopyright © 2005–2017 Oracle Corporation. All rights reserved.