public class RowValueHelper
extends java.lang.Object
RowValueHelper is an immutable (and therefore thread-safe) object, which caches computed information about the schema during construction, so typical usage is to re-use a single instance of the helper as needed for all RowValue instances that have the same schema.
See RowValue
Javadoc for example usage.
Constructor and Description |
---|
RowValueHelper(java.lang.String... schemaTypes)
Create a new RowValueHelper based on the specified schema type information.
|
Modifier and Type | Method and Description |
---|---|
RowValue |
createRowValue()
Create a new RowValue instance, with its data structured pre-allocated for
the field types of this schema.
|
java.lang.Iterable<java.lang.Object> |
fieldValues(RowValue rv)
Use the schema to iterate over each field in the specified row value, returning a Java
Object of the correct type for each field value.
|
int |
getTypedIndex(int fieldIndex)
Use the schema types to get the typedIndex (suitable for a RowValue.set/get call) from
a fieldIndex.
|
public RowValueHelper(java.lang.String... schemaTypes)
Do not create a new RowValueHelper for every RowValue, instead it is more efficient to reuse a single helper for many RowValue objects.
schemaTypes
- A params array indicating the type and order of fields in
this table's schema.public RowValue createRowValue()
public int getTypedIndex(int fieldIndex)
The correctness of this method is dependent on valid schema information being supplied - this method will return an out of range index if the schema and RowValue do not match, or if an invalid fieldIndex is specified (but it will not throw an exception).
fieldIndex
- The field index, i.e. n where n is the nth field in the row.public java.lang.Iterable<java.lang.Object> fieldValues(RowValue rv)
rv
- The RowValueSubmit a bug or feature
Copyright (c) 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.