Module datarush.library
Class AbstractRecordValued<F extends ScalarValued>
- java.lang.Object
-
- com.pervasive.datarush.tokens.record.AbstractRecordValued<F>
-
- Type Parameters:
F- the type ofScalarValuedobjects contained in the record
- All Implemented Interfaces:
RecordValued,TokenValued,RecordTyped,TokenTyped
- Direct Known Subclasses:
CompositeValue,RecordRegister,RecordToken
public abstract class AbstractRecordValued<F extends ScalarValued> extends Object implements RecordValued
For internal use only. A base implementation of aRecordValuedobject, providing implementations of all required methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRecordValued(RecordTokenType type, F[] fieldValues, boolean validateType, ModificationCountProvider modificationCountProvider)Constructs a value using the given elements as the field elements, using the specified type.protectedAbstractRecordValued(RecordTokenType type, F[] fieldValues, ModificationCountProvider modificationCountProvider)Constructs a value using the given elements as the field elements, using the specified type.protectedAbstractRecordValued(F[] fieldValues, ModificationCountProvider modificationCountProvider)Constructs a value using the given elements as the field elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsNull()Determines if any field in the record is null valued.protected TokenConvertergetConverter()Gets a memoized converter for this object.FgetField(int index)Get the field at the given index within the list of fields.FgetField(String fieldName)Gets the value of the field with the given name.F[]getFields()Gets the values of all fields in the recordRecordTokenTypegetType()Gets the data type of the token.booleanisNull()Indicates whether the token is null valued.ScalarValuedIteratornewFieldIterator(FieldIteratorProperties properties)Create a new iterator for visiting the fields in this RecordValued object.ScalarValuedIteratornewFieldIterator(ScalarTokenType type)Create a new iterator for visiting the fields in this RecordValued object.ScalarValuedIteratornewFieldIterator(ScalarTokenType type, String[] selectedFieldNames)Create a new iterator for visiting the fields in this RecordValued object.intsize()Gets the number of fields in the record schema.StringtoString()
-
-
-
Constructor Detail
-
AbstractRecordValued
protected AbstractRecordValued(F[] fieldValues, ModificationCountProvider modificationCountProvider)
Constructs a value using the given elements as the field elements. A type will be generated from the element types using default field names.- Parameters:
fieldValues- the elements to use as the fieldsmodificationCountProvider- modification count provider. required for notification of underlying changes.
-
AbstractRecordValued
protected AbstractRecordValued(RecordTokenType type, F[] fieldValues, ModificationCountProvider modificationCountProvider)
Constructs a value using the given elements as the field elements, using the specified type. The field types will be cross-validated against the elements.- Parameters:
type- the record schema to use for the valuefieldValues- the elements to use as the fieldsmodificationCountProvider- modification count provider. required for notification of underlying changes.- Throws:
DRException- if the provided field types disagree with the types of the elements
-
AbstractRecordValued
protected AbstractRecordValued(RecordTokenType type, F[] fieldValues, boolean validateType, ModificationCountProvider modificationCountProvider)
Constructs a value using the given elements as the field elements, using the specified type.- Parameters:
type- the record schema to use for the valuefieldValues- the elements to use as the fieldsvalidateType- indicates whether to cross-validate the type with the element typesmodificationCountProvider- modification count provider. required for notification of underlying changes.- Throws:
DRException- if type validation is requested and the provided field types disagree with the types of the elements
-
-
Method Detail
-
getType
public final RecordTokenType getType()
Description copied from interface:TokenValuedGets the data type of the token. This type will dictate the valid values that can be contained.- Specified by:
getTypein interfaceRecordTyped- Specified by:
getTypein interfaceRecordValued- Specified by:
getTypein interfaceTokenTyped- Specified by:
getTypein interfaceTokenValued- Returns:
- the token type.
-
size
public final int size()
Description copied from interface:RecordValuedGets the number of fields in the record schema.- Specified by:
sizein interfaceRecordValued- Returns:
- the number of fields
-
isNull
public final boolean isNull()
Description copied from interface:TokenValuedIndicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.- Specified by:
isNullin interfaceTokenValued- Returns:
trueif the token is null valued,falseotherwise
-
containsNull
public final boolean containsNull()
Description copied from interface:RecordValuedDetermines if any field in the record is null valued.- Specified by:
containsNullin interfaceRecordValued- Returns:
trueif at least one field is null valued,falseif none are
-
getField
public final F getField(int index)
Description copied from interface:RecordValuedGet the field at the given index within the list of fields.- Specified by:
getFieldin interfaceRecordValued- Parameters:
index- zero-based index into the field list- Returns:
- the field's value
-
getField
public final F getField(String fieldName)
Description copied from interface:RecordValuedGets the value of the field with the given name.- Specified by:
getFieldin interfaceRecordValued- Parameters:
fieldName- the field name- Returns:
- the field's value
-
getFields
public final F[] getFields()
Description copied from interface:RecordValuedGets the values of all fields in the record- Specified by:
getFieldsin interfaceRecordValued- Returns:
- an array containing the values of the record's fields
-
getConverter
protected final TokenConverter getConverter()
Gets a memoized converter for this object. Any conversion operations should use the returned converter to reduce the overhead of allocating converters each time one is required.- Returns:
- a converter usable with the value
-
newFieldIterator
public final ScalarValuedIterator newFieldIterator(ScalarTokenType type)
Description copied from interface:RecordValuedCreate a new iterator for visiting the fields in this RecordValued object. Visitation order will be sorted by the field's index.- Specified by:
newFieldIteratorin interfaceRecordValued- Parameters:
type- the type of fields over which to iterate- Returns:
- an iterator over fields of the specified type
-
newFieldIterator
public final ScalarValuedIterator newFieldIterator(ScalarTokenType type, String[] selectedFieldNames)
Description copied from interface:RecordValuedCreate a new iterator for visiting the fields in this RecordValued object. Visitation order will be sorted by the field's index.- Specified by:
newFieldIteratorin interfaceRecordValued- Parameters:
type- the type of fields over which to iterateselectedFieldNames- the fields over which to iterate- Returns:
- an iterator over the specified fields
-
newFieldIterator
public final ScalarValuedIterator newFieldIterator(FieldIteratorProperties properties)
Description copied from interface:RecordValuedCreate a new iterator for visiting the fields in this RecordValued object. Visitation order will optionally be sorted by the field's index, depending on the value ofFieldIteratorProperties.isSorted().- Specified by:
newFieldIteratorin interfaceRecordValued- Parameters:
properties- properties for the iterator- Returns:
- an iterator over the fields
-
-