|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simantics.databoard.accessor.java.JavaObject
org.simantics.databoard.accessor.java.JavaUnion
public class JavaUnion
Accessor to Java Object of Union Type
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor |
---|
Accessor.Listener |
Constructor Summary | |
---|---|
JavaUnion(Accessor parent,
UnionBinding binding,
java.lang.Object object,
AccessorParams params)
|
Method Summary | ||
---|---|---|
void |
addListener(Accessor.Listener listener,
InterestSet interestSet,
AccessorReference path)
Place a listener to an accessor node. |
|
int |
count()
Get the number of tag types |
|
|
getAccessor(AccessorReference reference)
Get an accessor to a sub-container. |
|
UnionBinding |
getBinding()
|
|
|
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 |
removeListener(Accessor.Listener listener)
Remove a listener. |
|
void |
setComponentValue(int tag,
Binding componentBinding,
java.lang.Object componentValue)
Set a new component value. |
|
void |
setValue(Binding unionBinding,
java.lang.Object newUnionValue)
Set a new Union value. |
|
UnionType |
type()
Get structural represtentation of the accessor presented in databoard's type system. |
Methods inherited from class org.simantics.databoard.accessor.java.JavaObject |
---|
apply, createAccessor, createSubAccessor, getEmitter, getObject, getParams, getReadLock, getValue, getWriteLock, notifyValueChanged, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.simantics.databoard.accessor.Accessor |
---|
apply, getValue |
Constructor Detail |
---|
public JavaUnion(Accessor parent, UnionBinding binding, java.lang.Object object, AccessorParams params)
Method Detail |
---|
public UnionType type()
Accessor
type
in interface Accessor
type
in interface UnionAccessor
type
in class JavaObject
public UnionBinding getBinding()
getBinding
in class JavaObject
public <T extends Accessor> T getAccessor(AccessorReference reference) throws AccessorConstructionException
Accessor
InvalidatedEvent is thrown from the accessor if it is unlinked from the parent hierarchy.
getAccessor
in interface Accessor
reference
- component reference or null
to return _this_ accessor
AccessorConstructionException
public int count() throws AccessorException
UnionAccessor
count
in interface UnionAccessor
AccessorException
public void setValue(Binding unionBinding, java.lang.Object newUnionValue) throws AccessorException
UnionAccessor
setValue
in interface Accessor
setValue
in interface UnionAccessor
AccessorException
public <T extends Accessor> T getComponentAccessor() throws AccessorConstructionException
UnionAccessor
getComponentAccessor
in interface UnionAccessor
AccessorConstructionException
public java.lang.Object getComponentValue(Binding componentBinding) throws AccessorException
UnionAccessor
getComponentValue
in interface UnionAccessor
componentBinding
- component binding
AccessorException
public int getTag() throws AccessorException
UnionAccessor
getTag
in interface UnionAccessor
AccessorException
public void setComponentValue(int tag, Binding componentBinding, java.lang.Object componentValue) throws AccessorException
UnionAccessor
setComponentValue
in interface UnionAccessor
AccessorException
public void addListener(Accessor.Listener listener, InterestSet interestSet, AccessorReference path) throws AccessorException
Accessor
When events are emited and in which thread processed is implementation specific. It is also implementation specific, whether the object can be mutated in the listener or whether it has to be done afterwards.
In many implementations there is a pluggable event handling strategy EventEmitter. The default behaviour is to emit events as they are spawned in the current thread.
There is a reference in each event instance that describes the path from the accessor where listener was placed to the node to which the event applies to.
Listener is attached to the object that holds the value at the time at the of the adding. For example, If a listener is attached to an array of element at index 3, and a new value is inserted at position 2, the listener still monitors the same container, which is now at index 4. The references of incoming the events are modified to have the new index.
Also, if a new value is assigned to the parent of an object that is listened, the listener keeps on monitoring the new value at the same reference. This doesn't apply when a new value is set to a union of different tag, to a variant with a new type, or value is removed from Optional type. In these two cases the listener is invalidated.
See ChangeSet
is an implementation that collects events.
addListener
in interface Accessor
addListener
in class JavaObject
path
- path to the accessor or null
. This is used in the events the accessor produces
AccessorException
collects events
public void removeListener(Accessor.Listener listener) throws AccessorException
Accessor
removeListener
in interface Accessor
removeListener
in class JavaObject
AccessorException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |