Class TimeDeserializer
java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<Long>
org.sentrysoftware.metricshub.engine.deserialization.TimeDeserializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
Custom JSON deserializer for converting timeout values to seconds.
Extends
JsonDeserializer and handles deserialization of timeout values in various formats.-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
com.fasterxml.jackson.databind.JsonDeserializer.None -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext ctxt) Deserialize the JSON value to aLongrepresenting the timeout in seconds.static longinterpretValueOf(@NonNull String value) Interpret the timeout value to have it in seconds.Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
-
Constructor Details
-
TimeDeserializer
public TimeDeserializer()
-
-
Method Details
-
deserialize
public Long deserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException Deserialize the JSON value to aLongrepresenting the timeout in seconds.- Specified by:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<Long>- Parameters:
parser- The JSON parser.ctxt- The deserialization context.- Returns:
- The timeout value in seconds.
- Throws:
IOException- If an I/O error occurs.
-
interpretValueOf
Interpret the timeout value to have it in seconds. The timeout is expected to be ordered from the biggest unit to the smallest : y > w > d > h > m > s > ms.- Parameters:
value- The value we wish to parse and interpret- Returns:
- long value
-