Class ConversionKeys

java.lang.Object
org.apache.sis.referencing.crs.ConversionKeys
All Implemented Interfaces:
Function<String,String>, ObjectConverter<String,String>

final class ConversionKeys extends Object implements ObjectConverter<String,String>
Provides a map without the "conversion." prefix in front of property keys. The method to invoke is unprefix(Map).
Since:
0.6
Version:
0.6
  • Field Details

    • PREFIX

      private static final String PREFIX
      The prefix to add or remove to the keys.
      See Also:
    • ADD

      private static final ConversionKeys ADD
      The converter for adding or removing the PREFIX in keys.
    • REMOVE

      private static final ConversionKeys REMOVE
      The converter for adding or removing the PREFIX in keys.
    • add

      private final boolean add
      true if this converter adds the prefix, or false if it removes it.
  • Constructor Details

    • ConversionKeys

      private ConversionKeys(boolean add)
      Creates a new converter which will add or remove the prefix.
  • Method Details

    • unprefix

      static <V> Map<String,V> unprefix(Map<String,V> properties)
      Provides a map without the "conversion." prefix in the keys.
      Type Parameters:
      V - type of values in the map.
      Parameters:
      properties - the user supplied properties.
    • getSourceClass

      public Class<String> getSourceClass()
      Returns the type of keys in the user supplied properties map.
      Specified by:
      getSourceClass in interface ObjectConverter<String,String>
      Returns:
      the type of objects to convert.
    • getTargetClass

      public Class<String> getTargetClass()
      Returns the type of keys in the derived properties.
      Specified by:
      getTargetClass in interface ObjectConverter<String,String>
      Returns:
      the type of converted objects.
    • properties

      public Set<FunctionProperty> properties()
      Returns the manner in which source keys are mapped to target keys.
      Specified by:
      properties in interface ObjectConverter<String,String>
      Returns:
      the manners in which source values are mapped to target values. May be an empty set, but never null.
    • apply

      public String apply(String key)
      Adds or removes the prefix from the specified key. In the removal case if the key does not begin with the prefix, then this method returns null.
      Specified by:
      apply in interface Function<String,String>
      Specified by:
      apply in interface ObjectConverter<String,String>
      Parameters:
      key - a key from the user supplied properties map.
      Returns:
      the key to show in the derived map.
    • inverse

      public ObjectConverter<String,String> inverse()
      Returns the inverse of this converter.
      Specified by:
      inverse in interface ObjectConverter<String,String>
      Returns:
      a converter for converting instances of T back to instances of S.
      See Also: