| java.lang.Object javax.faces.component._ComponentAttributesMap
_ComponentAttributesMap | class _ComponentAttributesMap implements Map,Serializable(Code) | | A custom implementation of the Map interface, where get and put calls
try to access getter/setter methods of an associated UIComponent before
falling back to accessing a real Map object.
Some of the behaviours of this class don't really comply with the
definitions of the Map class; for example the key parameter to all
methods is required to be of type String only, and after clear(),
calls to get can return non-null values. However the JSF spec
requires that this class behave in the way implemented below. See
UIComponent.getAttributes for more details.
The term "property" is used here to refer to real javabean properties
on the underlying UIComponent, while "attribute" refers to an entry
in the associated Map.
author: Manfred Geiler (latest modification by $Author: mbr $) version: $Revision: 518783 $ $Date: 2007-03-15 23:23:53 +0100 (Do, 15 Mrz 2007) $ |
Method Summary | |
public void | clear() Clear all the attributes in this map. | public boolean | containsKey(Object key) Return true if there is an attribute with the specified name,
but false if there is a javabean property of that name on the
associated UIComponent.
Note that it should be impossible for the attributes map to contain
an entry with the same name as a javabean property on the associated
UIComponent.
Parameters: key - must be a String. | public boolean | containsValue(Object value) Returns true if there is an attribute with the specified
value. | public Set | entrySet() Return a set of all attributes. | public boolean | equals(Object obj) TODO: Document why this method is necessary, and why it doesn't try to
compare the _component field. | public Object | get(Object key) In order: get the value of a property of the underlying
UIComponent, read an attribute from this map, or evaluate
the component's value-binding of the specified name.
Parameters: key - must be a String. | Map<Object, Object> | getUnderlyingMap() Return the map containing the attributes. | public int | hashCode() | public boolean | isEmpty() Return true if there are no attributes in this map. | public Set<Object> | keySet() Return a set of the keys for all attributes. | public Object | put(Object key, Object value) Store the provided value as a property on the underlying
UIComponent, or as an attribute in a Map if no such property
exists. | public void | putAll(Map t) Call put(key, value) for each entry in the provided map. | public Object | remove(Object key) Remove the attribute with the specified name. | public int | size() Return the number of attributes in this map. | public Collection<Object> | values() Return a collection of the values of all attributes. |
_ComponentAttributesMap | _ComponentAttributesMap(UIComponent component)(Code) | | Create a map backed by the specified component.
This method is expected to be called when a component is first created.
|
_ComponentAttributesMap | _ComponentAttributesMap(UIComponent component, Map<Object, Object> attributes)(Code) | | Create a map backed by the specified component. Attributes already
associated with the component are provided in the specified Map
class. A reference to the provided map is kept; this object's contents
are updated during put calls on this instance.
This method is expected to be called during the "restore view" phase.
|
clear | public void clear()(Code) | | Clear all the attributes in this map. Properties of the
underlying UIComponent are not modified.
Note that because the get method can read properties of the
UIComponent and evaluate value-bindings, it is possible to have
calls to the get method return non-null values immediately after
a call to clear.
|
containsKey | public boolean containsKey(Object key)(Code) | | Return true if there is an attribute with the specified name,
but false if there is a javabean property of that name on the
associated UIComponent.
Note that it should be impossible for the attributes map to contain
an entry with the same name as a javabean property on the associated
UIComponent.
Parameters: key - must be a String. Anything else will cause aClassCastException to be thrown. |
containsValue | public boolean containsValue(Object value)(Code) | | Returns true if there is an attribute with the specified
value. Properties of the underlying UIComponent aren't examined,
nor value-bindings.
Parameters: value - null is allowed |
entrySet | public Set entrySet()(Code) | | Return a set of all attributes. Properties of the underlying
UIComponent are not included, nor value-bindings.
|
equals | public boolean equals(Object obj)(Code) | | TODO: Document why this method is necessary, and why it doesn't try to
compare the _component field.
|
get | public Object get(Object key)(Code) | | In order: get the value of a property of the underlying
UIComponent, read an attribute from this map, or evaluate
the component's value-binding of the specified name.
Parameters: key - must be a String. Any other type will cause ClassCastException. |
getUnderlyingMap | Map<Object, Object> getUnderlyingMap()(Code) | | Return the map containing the attributes.
This method is package-scope so that the UIComponentBase class can access it
directly when serializing the component.
|
hashCode | public int hashCode()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | Return true if there are no attributes in this map. Properties
of the underlying UIComponent are not counted.
Note that because the get method can read properties of the
UIComponent and evaluate value-bindings, it is possible to have
isEmpty return true, while calls to the get method return non-null
values.
|
keySet | public Set<Object> keySet()(Code) | | Return a set of the keys for all attributes. Properties of the
underlying UIComponent are not included, nor value-bindings.
|
put | public Object put(Object key, Object value)(Code) | | Store the provided value as a property on the underlying
UIComponent, or as an attribute in a Map if no such property
exists. Value-bindings associated with the component are ignored; to
write to a value-binding, the value-binding must be explicitly
retrieved from the component and evaluated.
Note that this method is different from the get method, which
does read from a value-binding if one exists. When a value-binding
exists for a non-property, putting a value here essentially "masks"
the value-binding until that attribute is removed.
The put method is expected to return the previous value of the
property/attribute (if any). Because UIComponent property getter
methods typically try to evaluate any value-binding expression of
the same name this can cause an EL expression to be evaluated,
thus invoking a getter method on the user's model. This is fine
when the returned value will be used; Unfortunately this is quite
pointless when initialising a freshly created component with whatever
attributes were specified in the view definition (eg JSP tag
attributes). Because the UIComponent.getAttributes method
only returns a Map class and this class must be package-private,
there is no way of exposing a "putNoReturn" type method.
Parameters: key - String, null is not allowed Parameters: value - null is allowed |
putAll | public void putAll(Map t)(Code) | | Call put(key, value) for each entry in the provided map.
|
remove | public Object remove(Object key)(Code) | | Remove the attribute with the specified name. An attempt to
remove an entry whose name is that of a property on
the underlying UIComponent will cause an IllegalArgumentException.
Value-bindings for the underlying component are ignored.
Parameters: key - must be a String. Any other type will cause ClassCastException. |
size | public int size()(Code) | | Return the number of attributes in this map. Properties of the
underlying UIComponent are not counted.
Note that because the get method can read properties of the
UIComponent and evaluate value-bindings, it is possible to have
size return zero while calls to the get method return non-null
values.
|
values | public Collection<Object> values()(Code) | | Return a collection of the values of all attributes. Property
values are not included, nor value-bindings.
|
|
|