org.simantics.databoard.binding
Class IntegerBinding
java.lang.Object
org.simantics.databoard.binding.Binding
org.simantics.databoard.binding.NumberBinding
org.simantics.databoard.binding.IntegerBinding
- All Implemented Interfaces:
- java.util.Comparator<java.lang.Object>
- Direct Known Subclasses:
- IntegerBindingDefault, MutableIntegerBinding
public abstract class IntegerBinding
- extends NumberBinding
This is a binding of an Integer datatype. It is abstract and therfore
doesn't bind to any specific java class. Sub-classes bind to specific
classes.
Subclass IntegerJavaBinding binds to java.lang.Integer, and
MutableIntegerBinding to MutableInteger.
- Author:
- Toni Kalajainen
- See Also:
IntegerType
,
java.lang.Integer binding
,
MutableInteger binding
Method Summary |
|
accept(Binding.Visitor<T> v)
|
void |
accept(Binding.Visitor1 v,
java.lang.Object obj)
|
abstract java.lang.Object |
create(int value)
|
abstract java.lang.Object |
create(java.lang.Integer value)
|
abstract java.lang.Object |
create(java.lang.Number value)
Create value by converting it from any Number instance to a Number
instance of this Binding type. |
abstract java.lang.Object |
create(java.lang.String value)
Creates a value from its string representation |
java.lang.Object |
createUnchecked(int value)
|
java.lang.Object |
createUnchecked(java.lang.Integer value)
|
int |
deepCompare(java.lang.Object o1,
java.lang.Object o2,
java.util.Set<IdentityPair<java.lang.Object,java.lang.Object>> compareHistory)
|
int |
deepHashValue(java.lang.Object value,
java.util.IdentityHashMap<java.lang.Object,java.lang.Object> hashedObjects)
Calculate hash value |
abstract int |
getValue_(java.lang.Object obj)
|
abstract java.lang.Integer |
getValue(java.lang.Object obj)
Get numeric value of an object |
abstract boolean |
isInstance(java.lang.Object obj)
|
abstract void |
setValue(java.lang.Object obj,
int value)
|
abstract void |
setValue(java.lang.Object obj,
java.lang.Number value)
|
IntegerType |
type()
Get Data type |
Methods inherited from class org.simantics.databoard.binding.Binding |
assertInstaceIsValid, clone, cloneUnchecked, compare, createDefault, createDefaultUnchecked, createRandom, createRandomUnchecked, equals, hashValue, isImmutable, parseValue, parseValue, parseValueDefinition, printValue, printValueDefinition, serializer, serializer, serializerUnchecked |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
IntegerBinding
public IntegerBinding(IntegerType type)
type
public IntegerType type()
- Description copied from class:
NumberBinding
- Get Data type
- Overrides:
type
in class NumberBinding
- Returns:
- data type
create
public abstract java.lang.Object create(int value)
throws BindingException
- Throws:
BindingException
create
public abstract java.lang.Object create(java.lang.Integer value)
throws BindingException
- Throws:
BindingException
create
public abstract java.lang.Object create(java.lang.Number value)
throws BindingException
- Description copied from class:
NumberBinding
- Create value by converting it from any Number instance to a Number
instance of this Binding type.
NOTE WARNING! Using this method may lose precision or value in the conversion.
E.g. Double to Integer, or Long to Byte
- Specified by:
create
in class NumberBinding
- Returns:
- the value in the format of the binding type
- Throws:
BindingException
create
public abstract java.lang.Object create(java.lang.String value)
throws BindingException
- Description copied from class:
NumberBinding
- Creates a value from its string representation
- Specified by:
create
in class NumberBinding
- Returns:
- number
- Throws:
BindingException
getValue
public abstract java.lang.Integer getValue(java.lang.Object obj)
throws BindingException
- Description copied from class:
NumberBinding
- Get numeric value of an object
- Overrides:
getValue
in class NumberBinding
- Parameters:
obj
- object
- Returns:
- Number
- Throws:
BindingException
- thrown if obj is incorrect class
getValue_
public abstract int getValue_(java.lang.Object obj)
throws BindingException
- Throws:
BindingException
setValue
public abstract void setValue(java.lang.Object obj,
java.lang.Number value)
throws BindingException
- Specified by:
setValue
in class NumberBinding
- Throws:
BindingException
setValue
public abstract void setValue(java.lang.Object obj,
int value)
throws BindingException
- Throws:
BindingException
isInstance
public abstract boolean isInstance(java.lang.Object obj)
- Specified by:
isInstance
in class Binding
accept
public void accept(Binding.Visitor1 v,
java.lang.Object obj)
- Specified by:
accept
in class Binding
accept
public <T> T accept(Binding.Visitor<T> v)
- Specified by:
accept
in class Binding
deepCompare
public int deepCompare(java.lang.Object o1,
java.lang.Object o2,
java.util.Set<IdentityPair<java.lang.Object,java.lang.Object>> compareHistory)
throws BindingException
- Specified by:
deepCompare
in class Binding
- Throws:
BindingException
deepHashValue
public int deepHashValue(java.lang.Object value,
java.util.IdentityHashMap<java.lang.Object,java.lang.Object> hashedObjects)
throws BindingException
- Description copied from class:
Binding
- Calculate hash value
- Specified by:
deepHashValue
in class Binding
hashedObjects
- collection of already hashed object or optionally null
- Returns:
- hash value
- Throws:
BindingException
createUnchecked
public java.lang.Object createUnchecked(int value)
throws RuntimeBindingException
- Throws:
RuntimeBindingException
createUnchecked
public java.lang.Object createUnchecked(java.lang.Integer value)
throws RuntimeBindingException
- Throws:
RuntimeBindingException