java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<Long>
org.sentrysoftware.metricshub.engine.deserialization.TimeDeserializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider

public class TimeDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<Long>
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext ctxt)
    Deserialize the JSON value to a Long representing the timeout in seconds.
    static long
    interpretValueOf(@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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 a Long representing the timeout in seconds.
      Specified by:
      deserialize in class com.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

      public static long interpretValueOf(@NonNull @NonNull String value)
      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