org.simantics.databoard.reflection
Class ReflectionUnionClassBinding
java.lang.Object
org.simantics.databoard.binding.Binding
org.simantics.databoard.binding.UnionBinding
org.simantics.databoard.reflection.ReflectionUnionClassBinding
- All Implemented Interfaces:
- java.util.Comparator<java.lang.Object>
public class ReflectionUnionClassBinding
- extends UnionBinding
Binds a inheritance of classes into a union of records.
Method Summary |
java.lang.Object |
create(int tag,
java.lang.Object value)
|
int |
getTag(java.lang.Object obj)
Get tag number of an instance. |
java.lang.Object |
getValue(java.lang.Object obj)
|
boolean |
isImmutable()
Return true if the value is immutable. |
boolean |
isInstance(java.lang.Object obj)
|
void |
postConstruction(ReflectionBinding bindingScheme,
java.util.Map<org.simantics.databoard.reflection.ReflectionBinding.ClassBinding,Binding> map)
The second phase of the 2-phase construction. |
void |
setValue(java.lang.Object union,
int tag,
java.lang.Object value)
Set value to an union. |
Methods inherited from class org.simantics.databoard.binding.UnionBinding |
accept, accept, assertInstaceIsValid, count, create, createDefault, createUnchecked, deepCompare, deepHashValue, getComponentBinding, getComponentBindings, setComponentBindings, setTag, type |
Methods inherited from class org.simantics.databoard.binding.Binding |
assertInstaceIsValid, clone, cloneUnchecked, compare, createDefault, createDefaultUnchecked, createRandom, createRandomUnchecked, equals, hashValue, main, parseValue, parseValue, parseValueDefinition, printValue, printValueDefinition, serializer, serializer, serializerUnchecked, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
ReflectionUnionClassBinding
public ReflectionUnionClassBinding(UnionType type,
java.lang.Class<?> clazz)
throws BindingConstructionException
- Create a UnionType to Abstract Class Binding.
The construction is 2-phase.
The second phase (#postConstruction) adds sub class bindings.
- Parameters:
type
- clazz
-
- Throws:
BindingConstructionException
postConstruction
public void postConstruction(ReflectionBinding bindingScheme,
java.util.Map<org.simantics.databoard.reflection.ReflectionBinding.ClassBinding,Binding> map)
throws BindingConstructionException
- The second phase of the 2-phase construction.
- Throws:
BindingConstructionException
create
public java.lang.Object create(int tag,
java.lang.Object value)
- Specified by:
create
in class UnionBinding
setValue
public void setValue(java.lang.Object union,
int tag,
java.lang.Object value)
throws BindingException
- Description copied from class:
UnionBinding
- Set value to an union.
Throws BindingException if value cannot be written.
- Specified by:
setValue
in class UnionBinding
- Throws:
BindingException
getTag
public int getTag(java.lang.Object obj)
throws BindingException
- Description copied from class:
UnionBinding
- Get tag number of an instance.
- Specified by:
getTag
in class UnionBinding
- Returns:
- the tag number
- Throws:
BindingException
- is thrown if the instance is not a tag of this union
getValue
public java.lang.Object getValue(java.lang.Object obj)
- Specified by:
getValue
in class UnionBinding
isInstance
public boolean isInstance(java.lang.Object obj)
- Specified by:
isInstance
in class Binding
isImmutable
public boolean isImmutable()
- Description copied from class:
Binding
- Return true if the value is immutable.
This question excludes the immutability of the component types.
- Overrides:
isImmutable
in class Binding
- Returns:
true
value if immutable