Class MergedProperties

java.lang.Object
org.apache.sis.internal.util.AbstractMap<String,Object>
org.apache.sis.internal.referencing.MergedProperties
All Implemented Interfaces:
Map<String,Object>

public class MergedProperties extends AbstractMap<String,Object>
A map which first looks for values in a user supplied map, then looks in a default map if no value where found in the user supplied one. This map is for GeodeticObjectFactory and other SIS factories internal usage only.
Since:
0.6
Version:
0.6
  • Field Details

    • properties

      private final Map<String,?> properties
      The user supplied properties.
    • defaultProperties

      private final Map<String,?> defaultProperties
      Fallback for values not found in properties.
    • merge

      private transient Map<String,Object> merge
      A map containing the merge of user and default properties, or null if not yet created. This map is normally never needed. It may be created only if the user creates his own subclass of GeodeticObjectFactory or other factories and iterates on this map or asks for its size.
  • Constructor Details

    • MergedProperties

      public MergedProperties(Map<String,?> properties, Map<String,?> defaultProperties)
      Creates a new map which will merge the given properties on the fly.
      Parameters:
      properties - the user supplied properties.
      defaultProperties - fallback for values not found in properties.
  • Method Details

    • entryIterator

      protected AbstractMap.EntryIterator<String,Object> entryIterator()
      Returns an iterator over the user supplied properties together with the default properties which were not specified in the user's ones.
      Specified by:
      entryIterator in class AbstractMap<String,Object>
      Returns:
      iterator over merged properties.
    • get

      public Object get(Object key)
      Returns the value for the given key by first looking in the user supplied map, then by looking in the default properties if no value were specified in the user map. If there is no default value, invokes invisibleEntry(Object) in last resort.
      Parameters:
      key - the key for which to get the value.
      Returns:
      the value associated to the given key, or null if none.
    • invisibleEntry

      protected Object invisibleEntry(Object key)
      Returns the value for an "invisible" entry if no user supplied values were found for that key. This is used only for "secret" keys used for SIS internal purpose (not for public API).
      Example: GeodeticObjectFactory handles the "mtFactory" key in a special way since this is normally not needed for CRS, CS and datum objects, except when creating the SIS implementation of derived or projected CRS (because of the way we implemented derived CRS). But this is somewhat specific to SIS, so we do no want to expose this implementation details.
      Parameters:
      key - the key for which to get the value.
      Returns:
      the value associated to the given key, or null if none.