org.fourthline.cling.model.types
Class BooleanDatatype

java.lang.Object
  extended by org.fourthline.cling.model.types.AbstractDatatype<Boolean>
      extended by org.fourthline.cling.model.types.BooleanDatatype
All Implemented Interfaces:
Datatype<Boolean>

public class BooleanDatatype
extends AbstractDatatype<Boolean>

Author:
Christian Bauer

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fourthline.cling.model.types.Datatype
Datatype.Builtin, Datatype.Default
 
Constructor Summary
BooleanDatatype()
           
 
Method Summary
 String getString(Boolean value)
          Transforms a value supported by this datatype into a string representation.
 boolean isHandlingJavaType(Class type)
           
 Boolean 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, isValid, setBuiltin, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanDatatype

public BooleanDatatype()
Method Detail

isHandlingJavaType

public boolean isHandlingJavaType(Class type)
Specified by:
isHandlingJavaType in interface Datatype<Boolean>
Overrides:
isHandlingJavaType in class AbstractDatatype<Boolean>
Returns:
true if this datatype can handle values of the given Java type.

valueOf

public Boolean 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<Boolean>
Overrides:
valueOf in class AbstractDatatype<Boolean>
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(Boolean 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<Boolean>
Overrides:
getString in class AbstractDatatype<Boolean>
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


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