Schnittstelle Datatype<V>

Typparameter:
V - The Java type of the value handled by this datatype.
Alle bekannten Implementierungsklassen:
AbstractDatatype, Base64Datatype, BinHexDatatype, BooleanDatatype, CharacterDatatype, CustomDatatype, DateTimeDatatype, DoubleDatatype, FloatDatatype, IntegerDatatype, ShortDatatype, StringDatatype, UnsignedIntegerFourBytesDatatype, UnsignedIntegerOneByteDatatype, UnsignedIntegerTwoBytesDatatype, URIDatatype

public interface Datatype<V>
The type of a state variable value, able to convert to/from string representation.
Autor:
Christian Bauer
  • Methodendetails

    • isHandlingJavaType

      boolean isHandlingJavaType(Class type)
      Gibt zurück:
      true if this datatype can handle values of the given Java type.
    • getBuiltin

      Datatype.Builtin getBuiltin()
      Gibt zurück:
      The built-in UPnP standardized type this datatype is mapped to or null if this is a custom datatype.
    • isValid

      boolean isValid(V value)
      Parameter:
      value - The value to validate or null.
      Gibt zurück:
      Returns true if the value was null, validation result otherwise.
    • getString

      String getString(V value) throws InvalidValueException
      Transforms a value supported by this datatype into a string representation.

      This method calls isValid(Object) before converting the value, it throws an exception if validation fails.

      Parameter:
      value - The value to transform.
      Gibt zurück:
      The transformed value as a string, or an empty string when the value is null, never returns null.
      Löst aus:
      InvalidValueException
    • valueOf

      V valueOf(String s) throws InvalidValueException
      Transforms a string representation into a value of the supported type.
      Parameter:
      s - The string representation of a value.
      Gibt zurück:
      The converted value or null if the string was null or empty.
      Löst aus:
      InvalidValueException - If the string couldn't be parsed.
    • getDisplayString

      String getDisplayString()
      Gibt zurück:
      Metadata about this datatype, a nice string for display that describes this datatype (e.g. concrete class name).