Class PropertyMap
java.lang.Object
com.yahoo.processing.request.Properties
com.yahoo.processing.request.properties.PropertyMap
- All Implemented Interfaces:
Cloneable
A HashMap backing of Properties.
When this is cloned it will deep copy not only the model object map, but also each clonable member inside the map.
Subclassing is supported, a hook can be implemented to provide conditional inclusion in the map. By default - all properties are accepted, so set is never propagated.
This class is not multithread safe.
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this instance and recursively all chained instance.get
(CompoundName name, Map<String, String> context, Properties substitution) Gets a named value which (if necessary) is resolved using a property context.listProperties
(CompoundName path, Map<String, String> context, Properties substitution) Returns a snapshot of all properties of this having a given path prefix Some sources of properties may not be list-able and will not be included in this snapshot.void
Sets a value to the first chained instance which accepts it.protected boolean
shouldSet
(CompoundName name, Object value) Return true if this value should be set in this map, false if the set should be propagated instead This default implementation always returns true.Methods inherited from class com.yahoo.processing.request.Properties
asBoolean, asDouble, asInteger, asLong, asString, chain, chained, clearAll, clearAll, clearAll, clearAll, clone, cloneMap, get, get, get, get, get, get, get, getBoolean, getBoolean, getBoolean, getBoolean, getDouble, getDouble, getDouble, getDouble, getInstance, getInteger, getInteger, getInteger, getInteger, getLong, getLong, getLong, getLong, getString, getString, getString, getString, listProperties, listProperties, listProperties, listProperties, listProperties, listProperties, listProperties, set, set, set
-
Constructor Details
-
PropertyMap
public PropertyMap()
-
-
Method Details
-
set
Description copied from class:Properties
Sets a value to the first chained instance which accepts it. This default implementation forwards to the chained instance or throws a RuntimeException if there is not chained instance.- Overrides:
set
in classProperties
- Parameters:
name
- the name of the propertyvalue
- the value to set. Setting a property to null clears it.context
- the context used to resolve where the values should be set, or null if none
-
shouldSet
Return true if this value should be set in this map, false if the set should be propagated instead This default implementation always returns true. -
get
Description copied from class:Properties
Gets a named value which (if necessary) is resolved using a property context.- Overrides:
get
in classProperties
- Parameters:
name
- the name of the property to returncontext
- the variant resolution context, or null if nonesubstitution
- the properties used to substitute in these properties, or null if none
-
clone
Description copied from class:Properties
Clones this instance and recursively all chained instance. Implementations should call this and clone their own state as appropriate- Overrides:
clone
in classProperties
-
listProperties
public Map<String,Object> listProperties(CompoundName path, Map<String, String> context, Properties substitution) Description copied from class:Properties
Returns a snapshot of all properties of this having a given path prefix Some sources of properties may not be list-able and will not be included in this snapshot.- Overrides:
listProperties
in classProperties
- Parameters:
path
- the prefix (up to a ".") of the properties to return, or null or the empty string to return all propertiescontext
- the context used to resolve the properties, or null if nonesubstitution
- the properties which will be used to do string substitution in the values added to the map
-