Class DurationIso8601Deserializer

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<Duration>
dev.jcputney.elearning.parser.input.common.serialization.DurationIso8601Deserializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider

public class DurationIso8601Deserializer extends com.fasterxml.jackson.databind.JsonDeserializer<Duration>
Custom deserializer for Duration objects, allowing ISO 8601 duration strings to be parsed into Duration instances.

This deserializer supports durations in the format PnDTnHnMnS, where n represents days, hours, minutes, or seconds. It doesn't support months or years, as these aren't compatible with Duration.

  • 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
    Default constructor for the deserializer.
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext context)
    Deserializes a JSON value into a Duration object.

    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

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DurationIso8601Deserializer

      public DurationIso8601Deserializer()
      Default constructor for the deserializer.
  • Method Details

    • deserialize

      public Duration deserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext context) throws IOException
      Deserializes a JSON value into a Duration object.

      This method supports multiple duration formats:

      Specified by:
      deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<Duration>
      Parameters:
      parser - the JsonParser to read the value from
      context - context for the deserialization process
      Returns:
      the deserialized Duration object
      Throws:
      IOException - if the value can't be parsed as a duration, or if there's an issue with the parser
      IllegalArgumentException - if the parser is null