Class URLValueSerialiser

java.lang.Object
space.arim.dazzleconf.serialiser.URLValueSerialiser
All Implemented Interfaces:
ValueSerialiser<URL>

public final class URLValueSerialiser extends Object implements ValueSerialiser<URL>
Value serialiser for URL
Author:
A248
  • Method Details

    • getInstance

      public static URLValueSerialiser getInstance()
    • getTargetClass

      public Class<URL> getTargetClass()
      Description copied from interface: ValueSerialiser
      Gets the target type of deserialisation
      Specified by:
      getTargetClass in interface ValueSerialiser<URL>
      Returns:
      the target class type
    • deserialise

      public URL deserialise(FlexibleType flexibleType) throws BadValueException
      Description copied from interface: ValueSerialiser
      Deserialises a value from a flexible type representing a raw config value.

      The key (FlexibleType.getAssociatedKey()) is informative. It should not affect the deserialisation, but should be included in thrown BadValueExceptions to inform the user which key is in question.
      Specified by:
      deserialise in interface ValueSerialiser<URL>
      Parameters:
      flexibleType - the flexible type
      Returns:
      the deserialised value, never null
      Throws:
      BadValueException - if the value could not be deserialised
    • serialise

      public String serialise(URL value, Decomposer decomposer)
      Description copied from interface: ValueSerialiser
      Serialises a value to a raw config value. Should be the inverse operation of ValueSerialiser.deserialise(FlexibleType) in that if the result of this method were wrapped in a FlexibleType, it could be deserialised.

      If this serialiser serialises values by converting from another custom type, then the provided decomposer should be used to reserialise such custom types.
      Specified by:
      serialise in interface ValueSerialiser<URL>
      Parameters:
      value - the value
      decomposer - the decomposer used to help breakdown the value
      Returns:
      the serialised value