Class PropertyMap

java.lang.Object
com.yahoo.processing.request.Properties
com.yahoo.processing.request.properties.PropertyMap
All Implemented Interfaces:
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 Details

    • PropertyMap

      public PropertyMap()
  • Method Details

    • set

      public void set(CompoundName name, Object value, Map<String,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 class Properties
      Parameters:
      name - the name of the property
      value - 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, 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 Object get(CompoundName name, Map<String,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 class Properties
      Parameters:
      name - the name of the property to return
      context - the variant resolution context, or null if none
      substitution - 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 class Properties
    • 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 class Properties
      Parameters:
      path - the prefix (up to a ".") of the properties to return, or null or the empty string to return all properties
      context - the context used to resolve the properties, or null if none
      substitution - the properties which will be used to do string substitution in the values added to the map