Package com.adobe.cq.dam.cfm.extensions
Interface SemanticDateTimeFormatter
-
@ProviderType public interface SemanticDateTimeFormatter
Provides services that allow to convert different date and time representations.Following representations are supported:
- Original - any
Calendarobject or date/time-relatedStringrepresentation; may have any timezone setting and also unnormalized fields (see description of the semantic representation below for more information about normalization). - Semantic - normalized representations of an original
Calendarobject or date/time-related orStringrepresentation. For thedatesub-type, the time is guaranteed to be 00:00:00.000 and the semanticCalendarobject to be in the UTC timezone. For thetimesub-type, the date is guaranteed to be set to 1970-01-01 and the semanticCalendarobject to be in the UTC timezone.
- Original - any
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable java.lang.Stringformat(@NotNull java.util.Calendar value, @NotNull java.lang.String semanticType)Gets a string representation of the specifiedCalendarvalue for the given semantic type.@NotNull java.lang.Stringmap(@NotNull java.lang.String value, @NotNull java.lang.String semanticType)Maps an originalStringrepresentation to a suitable semanticStringrepresentation.@Nullable java.util.Calendarmap(@NotNull java.util.Calendar value, @NotNull java.lang.String semanticType)Maps an original Calendar object to a semantic Calendar object.@Nullable java.util.Calendarparse(@NotNull java.lang.String value, @NotNull java.lang.String semanticType)Parses aStringvalue to a semanticCalendarobject.
-
-
-
Method Detail
-
map
@Nullable @Nullable java.util.Calendar map(@NotNull @NotNull java.util.Calendar value, @NotNull @NotNull java.lang.String semanticType)Maps an original Calendar object to a semantic Calendar object.- Parameters:
value- TheCalendarobject to mapsemanticType- The semantic type to mapvalueto; supported values are:SemanticDataType.DATE,SemanticDataType.TIMEandSemanticDataType.DATETIME- Returns:
- The mapped semantic
Calendar
-
parse
@Nullable @Nullable java.util.Calendar parse(@NotNull @NotNull java.lang.String value, @NotNull @NotNull java.lang.String semanticType)Parses aStringvalue to a semanticCalendarobject.The format supported for strings is
[HH:mm[:ss]][yyyy-MM-dd['T'HH:mm:ss[.SSS][XXX]], which basically resembles ISO-8601.- Parameters:
value- The string to parsesemanticType- The semantic type to mapvalueto; supported values are:SemanticDataType.DATE,SemanticDataType.TIMEandSemanticDataType.DATETIME- Returns:
- The semantic
Calendarobject that matches the parsed string;nullif the string doesn't contain a valid date
-
format
@Nullable @Nullable java.lang.String format(@NotNull @NotNull java.util.Calendar value, @NotNull @NotNull java.lang.String semanticType)Gets a string representation of the specifiedCalendarvalue for the given semantic type.The string representation will be hh:mm:ss[.n...] (nanosecond portion is optional) for the
timesemantic type and yyyy-mm-dd fordate. The string representation for thedatetimesemantic type will be formatted as an ISO-8601-compliant string.- Parameters:
value- TheCalendarobject to create a string representation forsemanticType- the semantic type for the string representation- Returns:
- The string representation
-
map
@NotNull @NotNull java.lang.String map(@NotNull @NotNull java.lang.String value, @NotNull @NotNull java.lang.String semanticType)Maps an originalStringrepresentation to a suitable semanticStringrepresentation.The format supported for the returned value is
[HH:mm[:ss]][yyyy-MM-dd['T'HH:mm:ss[.SSS][XXX]], which basically resembles ISO-8601.- Parameters:
value- The string to mapsemanticType- The semantic type- Returns:
- The semantic string
-
-