Class DefaultMetadata.FromLocale

java.lang.Object
org.apache.sis.metadata.iso.DefaultMetadata.FromLocale
All Implemented Interfaces:
Function<Locale,PT_Locale>, ObjectConverter<Locale,PT_Locale>
Enclosing class:
DefaultMetadata

private static final class DefaultMetadata.FromLocale extends Object implements ObjectConverter<Locale,PT_Locale>
Converter from Locale and PT_Locale.
  • Field Details

  • Constructor Details

    • FromLocale

      private FromLocale()
  • Method Details

    • properties

      public Set<FunctionProperty> properties()
      Description copied from interface: ObjectConverter
      Returns the manner in which source values (S) are mapped to target values (T). Some possible function properties are:
      • Injective if no pair of S can produce the same T value (e.g.: conversions from Integer to String).
      • Surjective if every values of T can be created from one or many values of S (e.g.: conversions from String to Integer).
      • Bijective if there is a one-to-one relationship between the S and T values.
      • Order preserving if any sequence of increasing S values (in the sense of Comparable) is mapped to a sequence of increasing T values.
      • Order reversing if any sequence of increasing S values (in the sense of Comparable) is mapped to a sequence of decreasing T values.
      Note that if the ObjectConverter.apply(Object) method returns null for unconvertible source values, then this properties set cannot contain FunctionProperty.INJECTIVE because more than one source value could be converted to the same null target value.
      Specified by:
      properties in interface ObjectConverter<Locale,PT_Locale>
      Returns:
      the manners in which source values are mapped to target values. May be an empty set, but never null.
    • getSourceClass

      public Class<Locale> getSourceClass()
      Description copied from interface: ObjectConverter
      Returns the type of objects to convert.
      Specified by:
      getSourceClass in interface ObjectConverter<Locale,PT_Locale>
      Returns:
      the type of objects to convert.
    • getTargetClass

      public Class<PT_Locale> getTargetClass()
      Description copied from interface: ObjectConverter
      Returns the type of converted objects.
      Specified by:
      getTargetClass in interface ObjectConverter<Locale,PT_Locale>
      Returns:
      the type of converted objects.
    • apply

      public PT_Locale apply(Locale o)
      Description copied from interface: ObjectConverter
      Converts the given object from the source type S to the target type T. If the given object cannot be converted, then this method may either returns null or throws an exception, at implementation choice (except for injective functions, which must throw an exception - see the class Javadoc for more discussion about function properties).
      Example: in Apache SIS implementation, converters from String to Number distinguish two kinds of unconvertible objects:
      • Null or empty source string result in a null value to be returned.
      • All other kind of unparsable strings results in an exception to be thrown.
      In other words, the "" value is unconvertible but nevertheless considered as part of the converter domain, and is mapped to "no number". All other unparsable strings are considered outside the converter domain.
      Specified by:
      apply in interface Function<Locale,PT_Locale>
      Specified by:
      apply in interface ObjectConverter<Locale,PT_Locale>
      Parameters:
      o - the object to convert, or null.
      Returns:
      the converted object, or null.
    • inverse

      public ObjectConverter<PT_Locale,Locale> inverse()
      Description copied from interface: ObjectConverter
      Returns a converter capable to convert instances of T back to instances of S. Before to invoke this method, callers can verify if this converter is invertible as below:
      Specified by:
      inverse in interface ObjectConverter<Locale,PT_Locale>
      Returns:
      a converter for converting instances of T back to instances of S.
      See Also: