org.teleal.cling.model.types
Class IntegerDatatype

java.lang.Object
  extended by org.teleal.cling.model.types.AbstractDatatype<Integer>
      extended by org.teleal.cling.model.types.IntegerDatatype
All Implemented Interfaces:
Datatype<Integer>

public class IntegerDatatype
extends AbstractDatatype<Integer>

Although the UDA 1.0 spec doesn't say it, we assume that "int" is a 4 byte regular Java integer.

Author:
Christian Bauer

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.teleal.cling.model.types.Datatype
Datatype.Builtin, Datatype.Default
 
Constructor Summary
IntegerDatatype(int byteSize)
           
 
Method Summary
 int getByteSize()
           
 int getMaxValue()
           
 int getMinValue()
           
 boolean isHandlingJavaType(Class type)
           
 boolean isValid(Integer value)
           
 Integer valueOf(String s)
          Transforms a string representation into a value of the supported type.
 
Methods inherited from class org.teleal.cling.model.types.AbstractDatatype
getBuiltin, getDisplayString, getString, getValueType, setBuiltin, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerDatatype

public IntegerDatatype(int byteSize)
Method Detail

isHandlingJavaType

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

valueOf

public Integer 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<Integer>
Overrides:
valueOf in class AbstractDatatype<Integer>
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(Integer value)
Specified by:
isValid in interface Datatype<Integer>
Overrides:
isValid in class AbstractDatatype<Integer>
Parameters:
value - The value to validate or null.
Returns:
Returns true if the value was null, validation result otherwise.

getMinValue

public int getMinValue()

getMaxValue

public int getMaxValue()

getByteSize

public int getByteSize()


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.