Class DateConverter.Inverse

All Implemented Interfaces:
Serializable, Function<Long,Date>, ObjectConverter<Long,Date>
Enclosing class:
DateConverter<T>

private static final class DateConverter.Inverse extends SystemConverter<Long,Date>
Converter from Long to Date. This converter is not registered by ConverterRegistry.initialize(). Instead, SystemRegistry will fetch it when first needed by looking at the inverse of DateConverter.Long. The same is true for all inverse converters defined in the DateConverter enclosing class.
  • Field Details

  • Constructor Details

  • Method Details

    • inverse

      public ObjectConverter<Date,Long> inverse()
      Description copied from class: SystemConverter
      Default to non-invertible conversion. Must be overridden by subclasses that support inversions.
      Specified by:
      inverse in interface ObjectConverter<Long,Date>
      Overrides:
      inverse in class SystemConverter<Long,Date>
      Returns:
      a converter for converting instances of T back to instances of S.
      See Also:
    • unique

      public ObjectConverter<Long,Date> unique()
      Description copied from class: SystemConverter
      Returns an unique instance of this converter if one exists. If a converter already exists for the same source an target classes, then this converter is returned. Otherwise this converter is returned without being cached.
      Overrides:
      unique in class SystemConverter<Long,Date>
      Returns:
      the unique instance, or this if no unique instance can be found.
      See Also:
    • 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.
      Returns:
      the manners in which source values are mapped to target values. May be an empty set, but never null.
    • apply

      public Date apply(Long target)
      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.
      Parameters:
      target - the object to convert, or null.
      Returns:
      the converted object, or null.