- java.lang.Object
-
- com.pervasive.datarush.tokens.record.MutableComposite
-
- All Implemented Interfaces:
RecordSettable
,TokenSettable
,RecordTyped
,TokenTyped
public class MutableComposite extends Object implements RecordSettable
A composite of settable scalar fields. AMutableComposite
can be viewed as the loosest possible implementation ofRecordSettable
.- See Also:
RecordRegister
-
-
Constructor Summary
Constructors Constructor Description MutableComposite(RecordTokenType type, ScalarSettable[] fields)
Construct a composite with the described schema using the suppliedScalarSettable
objects.MutableComposite(T... fields)
Construct a composite with the described schema using the suppliedNamed
andScalarSettable
objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScalarSettable
getField(int index)
Get the field at the given index within the list of fields.ScalarSettable
getField(String fieldName)
Gets the settable for the field with the given name.ScalarSettable[]
getFields()
Gets the settables for all fields in the recordRecordTokenType
getType()
Gets the type of data tokens handled by the implementor.void
set(TokenValued value)
Sets the contained value to the given token value.void
setNull()
Sets the contained value to be null valued.void
setZero()
Sets the contained value to be zero valued.int
size()
Gets the number of fields in the record schema.
-
-
-
Constructor Detail
-
MutableComposite
public MutableComposite(T... fields)
Construct a composite with the described schema using the suppliedNamed
andScalarSettable
objects. The record type will be inferred from the provided fields.- Parameters:
fields
- the namedScalarSettable
objects to contain field values
-
MutableComposite
public MutableComposite(RecordTokenType type, ScalarSettable[] fields)
Construct a composite with the described schema using the suppliedScalarSettable
objects. The field types in the schema will be cross-validated against the given objects.- Parameters:
type
- the record schema to use for the resulting compositefields
- theScalarSettable
objects to contain field values- Throws:
DRException
- if the provided field types disagree with the types of the field objects
-
-
Method Detail
-
getType
public RecordTokenType getType()
Description copied from interface:TokenTyped
Gets the type of data tokens handled by the implementor.- Specified by:
getType
in interfaceRecordSettable
- Specified by:
getType
in interfaceRecordTyped
- Specified by:
getType
in interfaceTokenTyped
- Returns:
- the type of tokens associated with the class.
-
size
public int size()
Description copied from interface:RecordSettable
Gets the number of fields in the record schema.- Specified by:
size
in interfaceRecordSettable
- Returns:
- the number of fields
-
getField
public ScalarSettable getField(String fieldName)
Description copied from interface:RecordSettable
Gets the settable for the field with the given name.- Specified by:
getField
in interfaceRecordSettable
- Parameters:
fieldName
- the field name- Returns:
- the settable field
-
getField
public ScalarSettable getField(int index)
Description copied from interface:RecordSettable
Get the field at the given index within the list of fields.- Specified by:
getField
in interfaceRecordSettable
- Parameters:
index
- zero-based index into the field list- Returns:
- the settable field
-
getFields
public ScalarSettable[] getFields()
Description copied from interface:RecordSettable
Gets the settables for all fields in the record- Specified by:
getFields
in interfaceRecordSettable
- Returns:
- an array containing the settable fields
-
set
public void set(TokenValued value)
Description copied from interface:TokenSettable
Sets the contained value to the given token value. The given value must have a type compatible with this object.- Specified by:
set
in interfaceTokenSettable
- Parameters:
value
- the value to which to set the container
-
setNull
public void setNull()
Description copied from interface:TokenSettable
Sets the contained value to be null valued.- Specified by:
setNull
in interfaceTokenSettable
-
setZero
public void setZero()
Description copied from interface:TokenSettable
Sets the contained value to be zero valued.- Specified by:
setZero
in interfaceTokenSettable
-
-