org.simantics.databoard.binding.mutable
Class UnionTaggedObjectBinding

java.lang.Object
  extended by org.simantics.databoard.binding.Binding
      extended by org.simantics.databoard.binding.UnionBinding
          extended by org.simantics.databoard.binding.mutable.UnionTaggedObjectBinding
All Implemented Interfaces:
java.util.Comparator<java.lang.Object>

public class UnionTaggedObjectBinding
extends UnionBinding

Binds UnionType to TaggedObject.class

Author:
Toni Kalajainen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.simantics.databoard.binding.Binding
Binding.Visitor<T>, Binding.Visitor1
 
Constructor Summary
UnionTaggedObjectBinding(UnionType type, Binding[] componentBindings)
           
 
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 isInstance(java.lang.Object obj)
           
 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, create, createDefault, createUnchecked, deepCompare, deepHashValue, getComponentBinding, getComponentBinding, getComponentBinding, getComponentBindings, getComponentCount, readFrom, setComponentBindings, setTag, 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, 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
 

Constructor Detail

UnionTaggedObjectBinding

public UnionTaggedObjectBinding(UnionType type,
                                Binding[] componentBindings)
Method Detail

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)
                          throws BindingException
Specified by:
getValue in class UnionBinding
Throws:
BindingException

isInstance

public boolean isInstance(java.lang.Object obj)
Specified by:
isInstance in class Binding