|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pentaho.di.core.row.RowDataUtil
public class RowDataUtil
This class of static methods can be used to manipulate rows: add, delete, resize, etc... That way, when we want to go for a metadata driven system with hiding deletes, over sized arrays etc, we can change these methods to find occurrences.
For example, a step adding a field to the row should always call
public static Object[] resizeArray(Object[] objects, int newSize)which will either physically resize the array or return the original row, in case it was over-allocated and has enough slots. If a step needs to create new rows from scratch, it should use allocateRowData() which will return a somewhat over-allocated object array to fit the desired number of fields.
| Field Summary | |
|---|---|
static int |
OVER_ALLOCATE_SIZE
|
| Constructor Summary | |
|---|---|
RowDataUtil()
|
|
| Method Summary | |
|---|---|
static Object[] |
addRowData(Object[] one,
int sourceLength,
Object[] two)
Add two arrays and make one new one. |
static Object[] |
addValueData(Object[] rowData,
int length,
Object extra)
Add a single value to a row of data |
static Object[] |
allocateRowData(int size)
Allocate a new Object array. |
static Object[] |
createResizedCopy(Object[][] objects,
int[] lengths)
This method concatenates data from an array of rows, each with their own specific length. |
static Object[] |
createResizedCopy(Object[] objects,
int newSize)
Resize an object array making it bigger, over allocate, always create a copy of the original array, even if there's enough room in the old one. |
static Object[] |
removeItem(Object[] objects,
int index)
Remove an item from an Object array. |
static Object[] |
removeItems(Object[] rowData,
int[] index)
Remove a number of items in a row of data. |
static Object[] |
resizeArray(Object[] objects,
int newSize)
Resize an object array making it bigger, over allocate, return the original array if there's enough room. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int OVER_ALLOCATE_SIZE
| Constructor Detail |
|---|
public RowDataUtil()
| Method Detail |
|---|
public static Object[] allocateRowData(int size)
size - the minimum size to allocate.
public static Object[] resizeArray(Object[] objects,
int newSize)
objects - newSize -
public static Object[] createResizedCopy(Object[] objects,
int newSize)
objects - the original rownewSize - the new size
public static Object[] createResizedCopy(Object[][] objects,
int[] lengths)
objects - lengths -
public static Object[] removeItem(Object[] objects,
int index)
objects - index -
public static Object[] addRowData(Object[] one,
int sourceLength,
Object[] two)
one - The first arraythe - length of the row data or of it's longer, the location of the new extra value in the returned data rowtwo - The second array
public static Object[] addValueData(Object[] rowData,
int length,
Object extra)
rowData - The original row of datathe - length of the row data or of it's longer, the location of the new extra value in the returned data rowextra - The extra value to add
public static Object[] removeItems(Object[] rowData,
int[] index)
rowData - the row of data to remove fromindex - the index of all the items in the source table to remove.
We don't check if the same index gets deleted twice!
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||