org.simantics.databoard.accessor
Interface OptionalAccessor

All Superinterfaces:
Accessor
All Known Subinterfaces:
FileOptionalAccessor
All Known Implementing Classes:
BinaryOptional, JavaOptional

public interface OptionalAccessor
extends Accessor


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor
Accessor.Listener
 
Method Summary
<T extends Accessor>
T
getComponentAccessor()
          Get accessor to the component value or null if there is no component value
 java.lang.Object getComponentValue(Binding componentBinding)
          Return component value if there is a component value.
 boolean hasValue()
          Return true if there is a value assigned
 void setComponentValue(Binding componentBinding, java.lang.Object componentValue)
          Set a new component value.
 void setNoValue()
          Sets no value.
 void setValue(Binding componentBinding, java.lang.Object newComponentValue)
          Set a new value.
 OptionalType 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

setValue

void setValue(Binding componentBinding,
              java.lang.Object newComponentValue)
              throws AccessorException
Set a new value. Copies values from an Optional Value. If existing sub-value is removed, then possibly existing accessor is invalidated.

Specified by:
setValue in interface Accessor
Parameters:
componentBinding - of component type
newComponentValue - component value
Throws:
BindingException - binding error
java.lang.UnsupportedOperationException - cannot set a new value
AccessorException

setNoValue

void setNoValue()
                throws AccessorException
Sets no value. Any existing component accessor is invalidated.

Throws:
AccessorException

hasValue

boolean hasValue()
                 throws AccessorException
Return true if there is a value assigned

Returns:
true if there is a value
Throws:
AccessorException

getComponentValue

java.lang.Object getComponentValue(Binding componentBinding)
                                   throws AccessorException
Return component value if there is a component value. Exception is thrown if there is no component value.

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

setComponentValue

void setComponentValue(Binding componentBinding,
                       java.lang.Object componentValue)
                       throws AccessorException
Set a new component value. Any existing component accessor is invalidated.

Parameters:
componentBinding -
componentValue -
Throws:
AccessorException

getComponentAccessor

<T extends Accessor> T getComponentAccessor()
                                        throws AccessorConstructionException
Get accessor to the component value or null if there is no component value

Returns:
accessor or null
Throws:
AccessorConstructionException

type

OptionalType 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