Class GeneralizedTimeValueTranscoder

java.lang.Object
org.ldaptive.transcode.AbstractStringValueTranscoder<ZonedDateTime>
org.ldaptive.transcode.GeneralizedTimeValueTranscoder
All Implemented Interfaces:
ValueTranscoder<ZonedDateTime>

public class GeneralizedTimeValueTranscoder extends AbstractStringValueTranscoder<ZonedDateTime>
Decodes and encodes a generalized time for use in an ldap attribute value. See http://tools.ietf.org/html/rfc4517#section-3.3.13
  • Field Details

    • YEAR_PATTERN

      private static final String YEAR_PATTERN
      Pattern for capturing the year in generalized time.
      See Also:
    • MONTH_PATTERN

      private static final String MONTH_PATTERN
      Pattern for capturing the month in generalized time.
      See Also:
    • DAY_PATTERN

      private static final String DAY_PATTERN
      Pattern for capturing the day in generalized time.
      See Also:
    • HOUR_PATTERN

      private static final String HOUR_PATTERN
      Pattern for capturing hours in generalized time.
      See Also:
    • MIN_PATTERN

      private static final String MIN_PATTERN
      Pattern for capturing optional minutes in generalized time.
      See Also:
    • SECOND_PATTERN

      private static final String SECOND_PATTERN
      Pattern for capturing optional seconds in generalized time.
      See Also:
    • FRACTION_PATTERN

      private static final String FRACTION_PATTERN
      Pattern for capturing optional fraction in generalized time.
      See Also:
    • TIMEZONE_PATTERN

      private static final String TIMEZONE_PATTERN
      Pattern for capturing timezone in generalized time.
      See Also:
    • TIME_REGEX

      private static final Pattern TIME_REGEX
      Generalized time format regular expression.
    • DATE_FORMAT

      private static final DateTimeFormatter DATE_FORMAT
      Date format.
  • Constructor Details

    • GeneralizedTimeValueTranscoder

      public GeneralizedTimeValueTranscoder()
  • Method Details

    • decodeStringValue

      public ZonedDateTime decodeStringValue(String value)
      Description copied from interface: ValueTranscoder
      Decodes the supplied ldap attribute value into a custom type.
      Parameters:
      value - to decode
      Returns:
      decoded value
    • encodeStringValue

      public String encodeStringValue(ZonedDateTime value)
      Description copied from interface: ValueTranscoder
      Encodes the supplied value into an ldap attribute value.
      Parameters:
      value - to encode
      Returns:
      encoded value
    • getType

      public Class<ZonedDateTime> getType()
      Description copied from interface: ValueTranscoder
      Returns the type produced by this value transcoder.
      Returns:
      type produced by this value transcoder
    • parseGeneralizedTime

      protected ZonedDateTime parseGeneralizedTime(String value) throws ParseException
      Parses the supplied value and returns a date time.
      Parameters:
      value - of generalized time to parse
      Returns:
      date time initialized to the correct time
      Throws:
      ParseException - if the value does not contain correct generalized time syntax