Class 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 Detail

      • PropertyMap

        public PropertyMap()
    • 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 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,
                                    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 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 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 prefix

        Some sources of properties may not be list-able (e.g those using reflection) 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