org.fourthline.cling.model.types

## Class DateTimeDatatype

- java.lang.Object
- - org.fourthline.cling.model.types.AbstractDatatype<Calendar>
  - - org.fourthline.cling.model.types.DateTimeDatatype

- All Implemented Interfaces:
    Datatype<Calendar>

      public class DateTimeDatatype
      extends AbstractDatatype<Calendar>

  Author:
    Christian Bauer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.fourthline.cling.model.types.Datatype

      `Datatype.Builtin, Datatype.Default`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String[]` | `readFormats`
    `protected String` | `writeFormat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DateTimeDatatype(String[] readFormats, String writeFormat)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Date` | `getDateValue(String value, String[] formats)`
    `String` | `getString(Calendar value)` Transforms a value supported by this datatype into a string representation.
    `protected TimeZone` | `getTimeZone()`
    `protected String` | `normalizeTimeZone(String value)`
    `Calendar` | `valueOf(String s)` Transforms a string representation into a value of the supported type.

    - ### Methods inherited from class org.fourthline.cling.model.types.AbstractDatatype

      `getBuiltin, getDisplayString, getValueType, isHandlingJavaType, isValid, setBuiltin, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### readFormats

          protected String[] readFormats

    - #### writeFormat

          protected String writeFormat

  - ### Constructor Detail

    - #### DateTimeDatatype

          public DateTimeDatatype(String[] readFormats,
                          String writeFormat)

  - ### Method Detail

    - #### valueOf

          public Calendar 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<Calendar>`
      Overrides:
        `valueOf` in class `AbstractDatatype<Calendar>`
      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.

    - #### getString

          public String getString(Calendar 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<Calendar>`
      Overrides:
        `getString` in class `AbstractDatatype<Calendar>`
      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`

    - #### normalizeTimeZone

          protected String normalizeTimeZone(String value)

    - #### getDateValue

          protected Date getDateValue(String value,
                          String[] formats)

    - #### getTimeZone

          protected TimeZone getTimeZone()

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