|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.media.jai.PropertySourceImpl
A utility implementation of the PropertySource interface.
Properties are managed by three internal structures: one which maps
property names to values, a second which maps property names to
PropertySources, and a third which tracks which entries
in the name-value mapping derived their respective values from a
PropertySource in the name-PropertySource
mapping. The case of property names is retained for subsequent
retrieval but is ignored when the names are used as keys.
CaselessStringKey,
PropertySource,
WritablePropertySource,
WritablePropertySourceImpl, Serialized Form| Field Summary | |
protected Set |
cachedPropertyNames
CaselessStringKeys corresponding to the keys of entries
in properties which derived their respective
values from a PropertySource in
propertySources. |
protected Map |
properties
Mapping of CaselessStringKeys to values. |
protected Map |
propertySources
Mapping of CaselessStringKeys to
PropertySources. |
| Constructor Summary | |
protected |
PropertySourceImpl()
Constructs a PropertySourceImpl instance with
no properties set. |
|
PropertySourceImpl(Map propertyMap,
PropertySource propertySource)
Constructs a PropertySourceImpl instance which
will derive properties from one or both of the supplied parameters. |
| Method Summary | |
Map |
getProperties()
Copies into a Map all properties currently available
via this PropertySource. |
Object |
getProperty(String propertyName)
Returns the value of a property. |
Class |
getPropertyClass(String propertyName)
Returns the class expected to be returned by a request for the property with the specified name. |
String[] |
getPropertyNames()
Returns an array of Strings recognized as names by
this property source. |
String[] |
getPropertyNames(String prefix)
Returns an array of Strings recognized as names by
this property source that begin with the supplied prefix. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected transient Map properties
CaselessStringKeys to values.
If this object is serialized, only those entries of which
the value is serializable will be retained.protected transient Map propertySources
CaselessStringKeys to
PropertySources.
If this object is serialized, only those entries of which
the value is serializable will be retained.protected Set cachedPropertyNames
CaselessStringKeys corresponding to the keys of entries
in properties which derived their respective
values from a PropertySource in
propertySources.| Constructor Detail |
protected PropertySourceImpl()
PropertySourceImpl instance with
no properties set.
public PropertySourceImpl(Map propertyMap,
PropertySource propertySource)
PropertySourceImpl instance which
will derive properties from one or both of the supplied parameters.
The propertyMap and propertySource parameters
will be used to initialize the name-value and
name-PropertySource mappings, respectively.
Entries in the propertyMap object will be assumed
to be properties if the key is a String or a
CaselessStringKey. The propertySource
object will be queried for the names of properties that it emits
but requests for associated values will not be made at this time
so as to to defer any calculation that such requests might provoke.
The case of property names will be retained but will be ignored
insofar as the name is used as a key to the property value.propertyMap - A Map from which to copy properties
which have keys which are either Strings or
CaselessStringKeys.propertySource - A PropertySource from which to
derive properties.IllegalArgumentException - if propertyMap
and propertySource are both null
and this constructor is not being invoked from within a
subclass constructor. When invoked from a subclass
constructor both parameters may be null.| Method Detail |
public String[] getPropertyNames()
Strings recognized as names by
this property source. The case of the property names is retained.
If no properties are available, null will be returned.getPropertyNames in interface PropertySourceStrings giving the valid
property names or null.public String[] getPropertyNames(String prefix)
Strings recognized as names by
this property source that begin with the supplied prefix. If
no property names match, null will be returned.
The comparison is done in a case-independent manner.getPropertyNames in interface PropertySourceStrings giving the valid
property names.IllegalArgumentException - if prefix
is null.public Class getPropertyClass(String propertyName)
null will be returned.
This method queries only the name-value mapping so as to avoid
requesting a property value from a PropertySource
to which the name might refer via the name-PropertySource
mapping. If it is known from getPropertyNames() that
the property is emitted by this PropertySource but this
method returns null, then getProperty()
will have to be invoked and the Class obtained from
the property value itself.getPropertyClass in interface PropertySourcepropertyName - the name of the property, as a String.Class expected to be returneded by a
request for the value of this property or null.IllegalArgumentException - if propertyName
is null.public Object getProperty(String propertyName)
java.awt.Image.UndefinedProperty will
be returned.
If the requested name is found in the name-value mapping,
the corresponding value will be returned. Otherwise the
name-PropertySource mapping will be queried and the
value will be derived from the found PropertySource,
if any. If the value is derived from a PropertySource,
a record will be kept of this and this property will be referred to
as a "cached property".
getProperty in interface PropertySourcepropertyName - the name of the property, as a String.Object, or the value
java.awt.Image.UndefinedProperty.IllegalArgumentException - if propertyName
is null.public Map getProperties()
Map all properties currently available
via this PropertySource. All property values are
copied by reference rather than by being cloned. The keys in the
Map will be Strings with the original
property name case intact. Property values derived from the
name-value mapping will take precedence. The names of properties
whose values are derived via the name-PropertySource
mapping will be recorded as "cached properties".Map of all properties or null if
none are defined.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||