org.simantics.databoard.accessor
Interface RecordAccessor

All Superinterfaces:
Accessor
All Known Subinterfaces:
FileRecordAccessor
All Known Implementing Classes:
BinaryRecord, ClosableCompositeRecord, CompositeRecord, JavaRecord, StepwiseDatasourceAccessor

public interface RecordAccessor
extends Accessor

Accessor to a Record.

Author:
Toni Kalajainen

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor
Accessor.Listener
 
Method Summary
 int count()
          Get the number of fields in the record
<T extends Accessor>
T
getFieldAccessor(int index)
          Get an accessor to a field.
<T extends Accessor>
T
getFieldAccessor(java.lang.String fieldName)
          Get an accessor to a field.
 java.lang.Object getFieldValue(int index, Binding fieldBinding)
          Get field value.
 java.lang.Object getFieldValue(java.lang.String fieldName, Binding fieldBinding)
          Get field value.
 void setFieldValue(int index, Binding fieldBinding, java.lang.Object value)
          Set field value.
 void setFieldValue(java.lang.String fieldName, Binding fieldBinding, java.lang.Object value)
          Set field value.
 RecordType type()
          Get structural represtentation of the accessor presented in databoard's type system.
 
Methods inherited from interface org.simantics.databoard.accessor.Accessor
addListener, apply, getComponent, getValue, getValue, removeListener, setValue
 

Method Detail

count

int count()
          throws AccessorException
Get the number of fields in the record

Returns:
field count
Throws:
AccessorException

getFieldAccessor

<T extends Accessor> T getFieldAccessor(int index)
                                    throws AccessorConstructionException
Get an accessor to a field. The return value becomes invalid if a new value is assigned with setFieldValue(int, Binding, Object).

Parameters:
index -
Returns:
accessor to the field
Throws:
AccessorConstructionException

getFieldAccessor

<T extends Accessor> T getFieldAccessor(java.lang.String fieldName)
                                    throws AccessorConstructionException
Get an accessor to a field. The return value becomes invalid if a new value is assigned with setFieldValue(int, Binding, Object).

Parameters:
fieldName -
Returns:
accessor to the field
Throws:
AccessorConstructionException

getFieldValue

java.lang.Object getFieldValue(int index,
                               Binding fieldBinding)
                               throws AccessorException
Get field value. Note, use RecordAccessor#type().getComponentIndex( fieldName ) to get index.

Parameters:
index - field index
Returns:
the value of the field
Throws:
AccessorException

getFieldValue

java.lang.Object getFieldValue(java.lang.String fieldName,
                               Binding fieldBinding)
                               throws AccessorException
Get field value. Note, use RecordAccessor#type().getComponentIndex( fieldName ) to get index.

Parameters:
fieldName -
Returns:
the value of the field
Throws:
AccessorException

setFieldValue

void setFieldValue(int index,
                   Binding fieldBinding,
                   java.lang.Object value)
                   throws AccessorException
Set field value. Writing the current value again may not emit an event. This is implementation specific.

Parameters:
index - field index
fieldBinding -
value -
Throws:
AccessorException

setFieldValue

void setFieldValue(java.lang.String fieldName,
                   Binding fieldBinding,
                   java.lang.Object value)
                   throws AccessorException
Set field value. Writing the current value again may not emit an event. This is implementation specific.

Parameters:
fieldName -
fieldBinding -
value -
Throws:
AccessorException

type

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

Specified by:
type in interface Accessor
Returns:
type description