org.simantics.databoard.accessor
Interface UnionAccessor

All Superinterfaces:
Accessor
All Known Subinterfaces:
FileUnionAccessor
All Known Implementing Classes:
BinaryUnion, JavaUnion

public interface UnionAccessor
extends Accessor


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor
Accessor.Listener
 
Method Summary
 int count()
          Get the number of tag types
<T extends Accessor>
T
getComponentAccessor()
          Get an accessor to the component value.
 java.lang.Object getComponentValue(Binding componentBinding)
          Get the value
 int getTag()
          Get the union tag index
 void setComponentValue(int tag, Binding componentBinding, java.lang.Object componentValue)
          Set a new component value.
 void setValue(Binding unionBinding, java.lang.Object newUnion)
          Set a new Union value.
 UnionType type()
          Get structural represtentation of the accessor presented in databoard's type system format.
 
Methods inherited from interface org.simantics.databoard.accessor.Accessor
addListener, apply, getAccessor, getValue, removeListener
 

Method Detail

count

int count()
          throws AccessorException
Get the number of tag types

Returns:
the number of tag types
Throws:
AccessorException

getTag

int getTag()
           throws AccessorException
Get the union tag index

Returns:
tag index
Throws:
AccessorException

getComponentAccessor

<T extends Accessor> T getComponentAccessor()
                                        throws AccessorConstructionException
Get an accessor to the component value. The accessor becomes invalid if a new value is assigned.

Returns:
accessor to the value
Throws:
AccessorConstructionException

getComponentValue

java.lang.Object getComponentValue(Binding componentBinding)
                                   throws AccessorException
Get the value

Parameters:
componentBinding - component binding
Returns:
value
Throws:
AccessorException

setValue

void setValue(Binding unionBinding,
              java.lang.Object newUnion)
              throws AccessorException
Set a new Union value. If the tag-type changes and there is an accessor to the previous value, it becomes invalid.

Specified by:
setValue in interface Accessor
Parameters:
unionBinding -
newUnion -
Throws:
BindingException - binding error
java.lang.UnsupportedOperationException - cannot set a new value
AccessorException

setComponentValue

void setComponentValue(int tag,
                       Binding componentBinding,
                       java.lang.Object componentValue)
                       throws AccessorException
Set a new component value. The argument newValue may be captured or copied.

Parameters:
tag -
componentBinding -
componentValue -
Throws:
AccessorException

type

UnionType type()
Description copied from interface: Accessor
Get structural represtentation of the accessor presented in databoard's type system format.

Specified by:
type in interface Accessor
Returns:
type description