Package org.ldaptive.transcode
Class GeneralizedTimeValueTranscoder
java.lang.Object
org.ldaptive.transcode.AbstractStringValueTranscoder<ZonedDateTime>
org.ldaptive.transcode.GeneralizedTimeValueTranscoder
- All Implemented Interfaces:
ValueTranscoder<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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
Describes the fractional part of a generalized time string. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DateTimeFormatter
Date format.private static final String
Pattern for capturing the day in generalized time.private static final String
Pattern for capturing optional fraction in generalized time.private static final String
Pattern for capturing hours in generalized time.private static final String
Pattern for capturing optional minutes in generalized time.private static final String
Pattern for capturing the month in generalized time.private static final String
Pattern for capturing optional seconds in generalized time.private static final Pattern
Generalized time format regular expression.private static final String
Pattern for capturing timezone in generalized time.private static final String
Pattern for capturing the year in generalized time. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeStringValue
(String value) Decodes the supplied ldap attribute value into a custom type.encodeStringValue
(ZonedDateTime value) Encodes the supplied value into an ldap attribute value.getType()
Returns the type produced by this value transcoder.protected ZonedDateTime
parseGeneralizedTime
(String value) Parses the supplied value and returns a date time.Methods inherited from class org.ldaptive.transcode.AbstractStringValueTranscoder
decodeBinaryValue, encodeBinaryValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ldaptive.transcode.ValueTranscoder
decoder, encoder
-
Field Details
-
YEAR_PATTERN
Pattern for capturing the year in generalized time.- See Also:
-
MONTH_PATTERN
Pattern for capturing the month in generalized time.- See Also:
-
DAY_PATTERN
Pattern for capturing the day in generalized time.- See Also:
-
HOUR_PATTERN
Pattern for capturing hours in generalized time.- See Also:
-
MIN_PATTERN
Pattern for capturing optional minutes in generalized time.- See Also:
-
SECOND_PATTERN
Pattern for capturing optional seconds in generalized time.- See Also:
-
FRACTION_PATTERN
Pattern for capturing optional fraction in generalized time.- See Also:
-
TIMEZONE_PATTERN
Pattern for capturing timezone in generalized time.- See Also:
-
TIME_REGEX
Generalized time format regular expression. -
DATE_FORMAT
Date format.
-
-
Constructor Details
-
GeneralizedTimeValueTranscoder
public GeneralizedTimeValueTranscoder()
-
-
Method Details
-
decodeStringValue
Description copied from interface:ValueTranscoder
Decodes the supplied ldap attribute value into a custom type.- Parameters:
value
- to decode- Returns:
- decoded value
-
encodeStringValue
Description copied from interface:ValueTranscoder
Encodes the supplied value into an ldap attribute value.- Parameters:
value
- to encode- Returns:
- encoded value
-
getType
Description copied from interface:ValueTranscoder
Returns the type produced by this value transcoder.- Returns:
- type produced by this value transcoder
-
parseGeneralizedTime
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
-