|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simantics.databoard.accessor.binary.BinaryObject
org.simantics.databoard.accessor.binary.BinaryRecord
public class BinaryRecord
Accessor to a Binary Record.
Get and set field operations scan the file.
File operations are most efficient if field-specific subaccessors are acquired
and used instead of setFieldValue(int, Binding, Object)
and
getFieldValue(int, Binding)
.
Note, To increase the random access performance of the record, create sub-accessors of its fields.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor |
---|
Accessor.Listener |
Constructor Summary | |
---|---|
BinaryRecord(BinaryObject parent,
Blob blob,
RecordType type,
AccessorParams params)
|
Method Summary | ||
---|---|---|
void |
addListener(Accessor.Listener listener,
InterestSet interestSet,
ChildReference path)
Place a listener to an accessor node. |
|
int |
count()
Get the number of fields in the record |
|
|
getComponent(ChildReference reference)
Open an accessor to a child. |
|
|
getFieldAccessor(int index)
Get an accessor to a field. |
|
|
getFieldAccessor(java.lang.String fieldName)
Get an accessor to a field. |
|
java.lang.Object |
getFieldValue(int index,
Binding fieldBinding)
Get field value |
|
void |
removeListener(Accessor.Listener listener)
Remove a listener. |
|
void |
setFieldValue(int index,
Binding fieldBinding,
java.lang.Object value)
Set field value. |
|
void |
setFieldValueNoflush(int index,
Binding cb,
java.lang.Object cv)
|
|
void |
setValueNoflush(Binding binding,
java.lang.Object newValue)
Write a new value and don't flush the buffer |
|
RecordType |
type()
Get structural represtentation of the accessor presented in databoard's type system. |
Methods inherited from class org.simantics.databoard.accessor.binary.BinaryObject |
---|
apply, close, createAccessor, file, flush, getBinary, getEmitter, getParams, getReadLock, getSource, getValue, getValue, getWriteLock, setValue, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.simantics.databoard.accessor.file.FileAccessor |
---|
close, file, flush |
Methods inherited from interface org.simantics.databoard.accessor.Accessor |
---|
apply, getValue, getValue, setValue |
Constructor Detail |
---|
public BinaryRecord(BinaryObject parent, Blob blob, RecordType type, AccessorParams params) throws AccessorConstructionException
AccessorConstructionException
Method Detail |
---|
public RecordType type()
Accessor
type
in interface Accessor
type
in interface RecordAccessor
type
in class BinaryObject
public int count()
RecordAccessor
count
in interface RecordAccessor
public <T extends Accessor> T getFieldAccessor(java.lang.String fieldName) throws AccessorConstructionException
RecordAccessor
RecordAccessor.setFieldValue(int, Binding, Object)
.
getFieldAccessor
in interface RecordAccessor
AccessorConstructionException
public <T extends Accessor> T getFieldAccessor(int index) throws AccessorConstructionException
RecordAccessor
RecordAccessor.setFieldValue(int, Binding, Object)
.
getFieldAccessor
in interface RecordAccessor
AccessorConstructionException
public java.lang.Object getFieldValue(int index, Binding fieldBinding) throws AccessorException
RecordAccessor
getFieldValue
in interface RecordAccessor
AccessorException
public void setFieldValue(int index, Binding fieldBinding, java.lang.Object value) throws AccessorException
RecordAccessor
setFieldValue
in interface RecordAccessor
index
- field index
AccessorException
public void setFieldValueNoflush(int index, Binding cb, java.lang.Object cv) throws AccessorException
setFieldValueNoflush
in interface FileRecordAccessor
AccessorException
public void addListener(Accessor.Listener listener, InterestSet interestSet, ChildReference 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 BinaryObject
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 BinaryObject
AccessorException
public <T extends Accessor> T getComponent(ChildReference reference) throws AccessorConstructionException
Accessor
InvalidatedEvent is thrown from the accessor if it is unlinked from the parent hierarchy.
getComponent
in interface Accessor
reference
- component reference path or null
to return _this_ accessor
AccessorConstructionException
public void setValueNoflush(Binding binding, java.lang.Object newValue) throws AccessorException
BinaryObject
setValueNoflush
in interface FileAccessor
setValueNoflush
in class BinaryObject
AccessorException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |