org.teleal.cling.model.types
Class TimeDatatype
java.lang.Object
org.teleal.cling.model.types.AbstractDatatype<Long>
org.teleal.cling.model.types.TimeDatatype
- All Implemented Interfaces:
- Datatype<Long>
public class TimeDatatype
- extends AbstractDatatype<Long>
- Author:
- Christian Bauer
readFormats
protected String[] readFormats
writeFormat
protected String writeFormat
TimeDatatype
public TimeDatatype(String[] readFormats,
String writeFormat)
valueOf
public Long valueOf(String s)
throws InvalidValueException
- Description copied from interface:
Datatype
- Transforms a string representation into a value of the supported type.
- 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.
isValid
public boolean isValid(Long value)
- Specified by:
isValid
in interface Datatype<Long>
- Overrides:
isValid
in class AbstractDatatype<Long>
- Parameters:
value
- The value to validate or null
.
- Returns:
- Returns
true
if the value was null
, validation result otherwise.
getString
public String getString(Long 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<Long>
- Overrides:
getString
in class AbstractDatatype<Long>
- 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 © 2010 Teleal GmbH, Switzerland. All Rights Reserved.