java.lang.Object
io.cloudevents.types.Time
Utilities to handle the CloudEvent Attribute Timestamp type
-
Method Summary
Modifier and TypeMethodDescriptionstatic OffsetDateTimeParse aStringRFC3339 compliant asOffsetDateTime.static OffsetDateTimeParse an attribute/extension with RFC3339 compliantStringvalue asOffsetDateTime.static StringwriteTime(String attributeName, OffsetDateTime time) Convert an attribute/extensionOffsetDateTimeto a RFC3339 compliantString.static StringwriteTime(OffsetDateTime time) Convert aOffsetDateTimeto a RFC3339 compliantString.
-
Method Details
-
parseTime
Parse aStringRFC3339 compliant asOffsetDateTime.- Parameters:
time- the value to parse as time- Returns:
- the parsed
OffsetDateTime - Throws:
DateTimeParseException- if something went wrong when parsing the provided time.
-
parseTime
public static OffsetDateTime parseTime(String attributeName, String time) throws CloudEventRWException Parse an attribute/extension with RFC3339 compliantStringvalue asOffsetDateTime.- Parameters:
attributeName- the attribute/extension nametime- the value to parse as time- Returns:
- the parsed
OffsetDateTime - Throws:
CloudEventRWException- if something went wrong when parsing the attribute/extension.
-
writeTime
Convert aOffsetDateTimeto a RFC3339 compliantString.- Parameters:
time- the time to write asString- Returns:
- the serialized time
- Throws:
DateTimeException- if something went wrong when serializing the provided time.
-
writeTime
Convert an attribute/extensionOffsetDateTimeto a RFC3339 compliantString.- Parameters:
attributeName- the attribute/extension nametime- the time to write asString- Returns:
- the serialized time
- Throws:
CloudEventRWException- if something went wrong when serializing the attribute/extension.DateTimeException
-