Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.fourthline.cling.model.types
Class AbstractDatatype<V>

    java.lang.Object
      org.fourthline.cling.model.types.AbstractDatatype<V>

All Implemented Interfaces:
  Datatype<V>

Direct Known Subclasses:
  Base64Datatype, BinHexDatatype, BooleanDatatype, CharacterDatatype, CustomDatatype, DateTimeDatatype, DoubleDatatype, FloatDatatype, IntegerDatatype, ShortDatatype, StringDatatype, UnsignedIntegerFourBytesDatatype, UnsignedIntegerOneByteDatatype, UnsignedIntegerTwoBytesDatatype, URIDatatype

    public abstract class AbstractDatatype<V>

extends Object
implements Datatype<V>

Author:
  Christian Bauer

Nested Class Summary

Nested classes/interfaces inherited from interface org.fourthline.cling.model.types.Datatype
`Datatype.Builtin, Datatype.Default`

Constructor Summary
`AbstractDatatype()`

Method Summary
`Datatype.Builtin` | `getBuiltin()`
`String` | `getDisplayString()`
`String` | `getString(V value)` Transforms a value supported by this datatype into a string representation.
`protected Class<V>` | `getValueType()`
`boolean` | `isHandlingJavaType(Class type)`
`boolean` | `isValid(V value)`
`void` | `setBuiltin(Datatype.Builtin builtin)`
`String` | `toString()`
`V` | `valueOf(String s)` Transforms a string representation into a value of the supported type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AbstractDatatype

    public AbstractDatatype()

Method Detail

### getValueType

    protected Class<V> getValueType()

### isHandlingJavaType

    public boolean isHandlingJavaType(Class type)

  Specified by:
    `isHandlingJavaType` in interface `Datatype<V>`
  Returns:
    `true` if this datatype can handle values of the given Java type.

### valueOf

    public V valueOf(String s)
              throws InvalidValueException

  Description copied from interface: `Datatype`
  Transforms a string representation into a value of the supported type.

  Specified by:
    `valueOf` in interface `Datatype<V>`
  Parameters:
    `s` - The string representation of a value.
  Returns:
    The converted value or `null` if the string was `null` or empty.
  Throws:
    `InvalidValueException` - If the string couldn't be parsed.

### getBuiltin

    public Datatype.Builtin getBuiltin()

  Specified by:
    `getBuiltin` in interface `Datatype<V>`
  Returns:
    The built-in UPnP standardized type this datatype is mapped to or `null` if this is a custom datatype.

### setBuiltin

    public void setBuiltin(Datatype.Builtin builtin)

### getString

    public String getString(V value)
                     throws InvalidValueException

  Description copied from interface: `Datatype`
  Transforms a value supported by this datatype into a string representation.

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

  Specified by:
    `getString` in interface `Datatype<V>`
  Parameters:
    `value` - The value to transform.
  Returns:
    The transformed value as a string, or an empty string when the value is null, never returns `null`.
  Throws:
    `InvalidValueException`

### isValid

    public boolean isValid(V value)

  Specified by:
    `isValid` in interface `Datatype<V>`
  Parameters:
    `value` - The value to validate or `null`.
  Returns:
    Returns `true` if the value was `null`, validation result otherwise.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getDisplayString

    public String getDisplayString()

  Specified by:
    `getDisplayString` in interface `Datatype<V>`
  Returns:
    Metadata about this datatype, a nice string for display that describes this datatype (e.g. concrete class name).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.