Class PropertyMap
- java.lang.Object
-
- com.yahoo.processing.request.Properties
-
- com.yahoo.processing.request.properties.PropertyMap
-
- All Implemented Interfaces:
java.lang.Cloneable
public class PropertyMap extends Properties
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
Constructors Constructor Description PropertyMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyMap
clone()
Clones this instance and recursively all chained instance.java.lang.Object
get(CompoundName name, java.util.Map<java.lang.String,java.lang.String> context, Properties substitution)
Gets a named value which (if necessary) is resolved using a property context.java.util.Map<java.lang.String,java.lang.Object>
listProperties(CompoundName path, java.util.Map<java.lang.String,java.lang.String> context, Properties substitution)
Returns a snapshot of all properties of this having a given path prefixvoid
set(CompoundName name, java.lang.Object value, java.util.Map<java.lang.String,java.lang.String> context)
Sets a value to the first chained instance which accepts it.protected boolean
shouldSet(CompoundName name, java.lang.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
-
-
-
-
Method Detail
-
set
public void set(CompoundName name, java.lang.Object value, java.util.Map<java.lang.String,java.lang.String> context)
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
protected boolean shouldSet(CompoundName name, java.lang.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.
-
get
public java.lang.Object get(CompoundName name, java.util.Map<java.lang.String,java.lang.String> context, Properties substitution)
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
public PropertyMap 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 java.util.Map<java.lang.String,java.lang.Object> listProperties(CompoundName path, java.util.Map<java.lang.String,java.lang.String> context, Properties substitution)
Description copied from class:Properties
Returns a snapshot of all properties of this having a given path prefixSome sources of properties may not be list-able (e.g those using reflection) 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
-
-