|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RowMetaInterface
This interface provides methods to describe and manipulate a row's structure. The interface is similar to the JDBC ResultSet interface in that it provides a means of getting data from a row.
Inside processRow() a step typically retrieves the structure of incoming rows by calling getInputRowMeta(), which is provided by the BaseStep class. The step would usually clone this object and pass it to getFields() of its meta class, to reflect any changes in row structure caused by the step itself. Now the step has RowMetaInterface objects describing both the input and output rows.
Usually a step would look for the indexes and types of relevant fields upon first execution of processRow(). The following methods of RowMetaInterface are particularly useful in that regard:
public int indexOfValue(...)
Given a field name, determine the index of the field in the row.
public String[] getFieldNames()
Returns an array of field names. The index of a field name matches the field index in the row array.
public void searchValueMeta(String valueName)
Given a field name, determine the meta data for the field.
public vValueMetaInterface getValueMeta(...)
Given a field index, determine the meta data for the field.
public List
Returns a list of all field descriptions. The index of the field description matches the field index in the row array.
Method Summary | |
---|---|
void |
addRowMeta(RowMetaInterface rowMeta)
Add a number of fields from another row (append to the end). |
void |
addValueMeta(int index,
ValueMetaInterface meta)
Add a metadata value on a certain location in the row. |
void |
addValueMeta(ValueMetaInterface meta)
Add a metadata value, extends the array if needed. |
void |
clear()
Clear the row metadata. |
RowMetaInterface |
clone()
Clone this RowMetaInterface object. |
Object[] |
cloneRow(Object[] objects)
Clone row. |
Object[] |
cloneRow(Object[] objects,
Object[] cloneTo)
Clone row. |
int |
compare(Object[] rowData1,
Object[] rowData2)
Compare 2 rows with each other using all values in the rows and also considering the specified ascending clauses of the value metadata. |
int |
compare(Object[] rowData1,
Object[] rowData2,
int[] fieldnrs)
Compare 2 rows with each other using certain values in the rows and also considering the specified ascending clauses of the value metadata. |
int |
compare(Object[] rowData1,
Object[] rowData2,
int[] fieldnrs1,
int[] fieldnrs2)
Compare 2 rows with each other using certain values in the rows and also considering the specified ascending clauses of the value metadata. |
int |
compare(Object[] rowData1,
RowMetaInterface rowMeta2,
Object[] rowData2,
int[] fieldnrs1,
int[] fieldnrs2)
Compare 2 rows with each other using certain values in the rows and also considering the specified ascending clauses of the value metadata. |
int |
convertedValuesHashCode(Object[] rowData)
Calculates a hashcode of the converted value of all objects in the supplied row. |
boolean |
equals(Object[] rowData1,
Object[] rowData2,
int[] fieldnrs)
Compare 2 rows with each other for equality using certain values in the rows and also considering the case sensitivity flag. |
boolean |
exists(ValueMetaInterface meta)
Check if a value is already present in this row with the same name. |
BigDecimal |
getBigNumber(Object[] dataRow,
int index)
Get a BigNumber value from a row of data. |
byte[] |
getBinary(Object[] dataRow,
int index)
Get a Binary value from a row of data. |
Boolean |
getBoolean(Object[] dataRow,
int index)
Get a Boolean value from a row of data. |
String |
getDataXML(Object[] rowData)
Gets the data xml. |
Date |
getDate(Object[] dataRow,
int index)
Get a Date value from a row of data. |
Date |
getDate(Object[] dataRow,
String valueName,
Date defaultValue)
Gets the date. |
String[] |
getFieldNames()
Get an array of the names of all the Values in the Row. |
String[] |
getFieldNamesAndTypes(int maxlen)
Get an array of strings showing the name of the values in the row padded to a maximum length, followed by the types of the values. |
Long |
getInteger(Object[] dataRow,
int index)
Get an Integer value from a row of data. |
Long |
getInteger(Object[] dataRow,
String valueName,
Long defaultValue)
Gets the integer. |
String |
getMetaXML()
Gets the meta xml. |
Double |
getNumber(Object[] dataRow,
int index)
Get a Number value from a row of data. |
Object[] |
getRow(Node node)
Convert an XML node into binary data using the row metadata supplied. |
String |
getString(Object[] row)
Get the string representation of the data in a row of data. |
String |
getString(Object[] dataRow,
int index)
Get a String value from a row of data. |
String |
getString(Object[] dataRow,
String valueName,
String defaultValue)
Gets the string. |
ValueMetaInterface |
getValueMeta(int index)
Get the value metadata on the specified index. |
List<ValueMetaInterface> |
getValueMetaList()
Gets the value meta list. |
int |
hashCode(Object[] rowData)
Calculates a simple hashCode of all the native data objects in the supplied row. |
int |
indexOfValue(String valueName)
Searches the index of a value meta with a given name. |
boolean |
isEmpty()
Returns true if there are no elements in the row metadata. |
boolean |
isNull(Object[] dataRow,
int index)
Determines whether a value in a row is null. |
void |
mergeRowMeta(RowMetaInterface r)
Merge the values of row r to this Row. |
int |
oldXORHashCode(Object[] rowData)
Deprecated. |
Object[] |
readData(DataInputStream inputStream)
De-serialize a row of data (no metadata is read) from an input stream. |
void |
removeValueMeta(int index)
Remove a value metadata object on a certain index in the row. |
void |
removeValueMeta(String string)
Remove a value with a certain name from the row metadata. |
ValueMetaInterface |
searchValueMeta(String valueName)
Searches for a value with a certain name in the value meta list. |
void |
setValueMeta(int index,
ValueMetaInterface valueMeta)
Replaces a value meta entry in the row metadata with another one. |
void |
setValueMetaList(List<ValueMetaInterface> valueMetaList)
Sets the value meta list. |
int |
size()
Returns the size of the metadata row. |
String |
toStringMeta()
To string meta. |
void |
writeData(DataOutputStream outputStream,
Object[] data)
Write a serialized version of the supplied data to the outputStream (based on the metadata but not the metadata itself). |
void |
writeMeta(DataOutputStream outputStream)
Write a serialized version of this class (Row Metadata) to the specified outputStream. |
Method Detail |
---|
List<ValueMetaInterface> getValueMetaList()
void setValueMetaList(List<ValueMetaInterface> valueMetaList)
valueMetaList
- the list of valueMeta to setboolean exists(ValueMetaInterface meta)
meta
- the value to check for existence
void addValueMeta(ValueMetaInterface meta)
meta
- The metadata value to addvoid addValueMeta(int index, ValueMetaInterface meta)
index
- The index where the metadata value needs to be put in the rowmeta
- The metadata value to add to the rowValueMetaInterface getValueMeta(int index)
index
- The index to get the value metadata from
void setValueMeta(int index, ValueMetaInterface valueMeta)
index
- The index in the row to replace atvalueMeta
- the metadata to replace withString getString(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.Long getInteger(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.Double getNumber(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.Date getDate(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.BigDecimal getBigNumber(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.Boolean getBoolean(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.byte[] getBinary(Object[] dataRow, int index) throws KettleValueException
dataRow
- the data rowindex
- the index
KettleValueException
- in case there was a problem converting the data.Object[] cloneRow(Object[] objects, Object[] cloneTo) throws KettleValueException
objects
- objects to clonecloneTo
- objects to clone to
KettleValueException
- in case something is not quite right with the expected dataObject[] cloneRow(Object[] objects) throws KettleValueException
objects
- object to clone
KettleValueException
- in case something is not quite right with the expected dataint size()
boolean isEmpty()
boolean isNull(Object[] dataRow, int index) throws KettleValueException
dataRow
- The row of dataindex
- the index to reference
KettleValueException
- in case there is a conversion error (only thrown in case of lazy conversion)RowMetaInterface clone()
String getString(Object[] dataRow, String valueName, String defaultValue) throws KettleValueException
dataRow
- the data rowvalueName
- the value namedefaultValue
- the default value
KettleValueException
- the kettle value exceptionLong getInteger(Object[] dataRow, String valueName, Long defaultValue) throws KettleValueException
dataRow
- the data rowvalueName
- the value namedefaultValue
- the default value
KettleValueException
- the kettle value exceptionDate getDate(Object[] dataRow, String valueName, Date defaultValue) throws KettleValueException
dataRow
- the data rowvalueName
- the value namedefaultValue
- the default value
KettleValueException
- the kettle value exceptionValueMetaInterface searchValueMeta(String valueName)
valueName
- The value name to search for
int indexOfValue(String valueName)
valueName
- the name of the value metadata to look for
void addRowMeta(RowMetaInterface rowMeta)
rowMeta
- The row of metadata values to addvoid mergeRowMeta(RowMetaInterface r)
r
- The row to be merged with this rowString[] getFieldNames()
void writeMeta(DataOutputStream outputStream) throws KettleFileException
outputStream
- the outputstream to write to
KettleFileException
- in case a I/O error occursvoid writeData(DataOutputStream outputStream, Object[] data) throws KettleFileException
outputStream
- the outputstream to write todata
- the data to write after the metadata
KettleFileException
- in case a I/O error occursObject[] readData(DataInputStream inputStream) throws KettleFileException, SocketTimeoutException
inputStream
- the inputstream to read from
KettleFileException
- in case a I/O error occurs
SocketTimeoutException
- In case there is a timeout during reading.void clear()
void removeValueMeta(String string) throws KettleValueException
string
- the name of the value metadata to remove
KettleValueException
- in case the value couldn't be found in the row metadatavoid removeValueMeta(int index)
index
- the index to remove the value metadata fromString getString(Object[] row) throws KettleValueException
row
- the row of data to convert to string
KettleValueException
- in case of a conversion errorString[] getFieldNamesAndTypes(int maxlen)
maxlen
- The length to which the name will be padded.
int compare(Object[] rowData1, Object[] rowData2, int[] fieldnrs) throws KettleValueException
rowData1
- The first row of datarowData2
- The second row of datafieldnrs
- the fields to compare on (in that order)
KettleValueException
- the kettle value exceptionboolean equals(Object[] rowData1, Object[] rowData2, int[] fieldnrs) throws KettleValueException
rowData1
- The first row of datarowData2
- The second row of datafieldnrs
- the fields to compare on (in that order)
KettleValueException
- the kettle value exceptionint compare(Object[] rowData1, Object[] rowData2, int[] fieldnrs1, int[] fieldnrs2) throws KettleValueException
rowData1
- The first row of datarowData2
- The second row of datafieldnrs1
- The indexes of the values to compare in the first rowfieldnrs2
- The indexes of the values to compare with in the second row
KettleValueException
- the kettle value exceptionint compare(Object[] rowData1, RowMetaInterface rowMeta2, Object[] rowData2, int[] fieldnrs1, int[] fieldnrs2) throws KettleValueException
rowData1
- The first row of datarowMeta2
- the metadat of the second row of datarowData2
- The second row of datafieldnrs1
- The indexes of the values to compare in the first rowfieldnrs2
- The indexes of the values to compare with in the second row
KettleValueException
- the kettle value exceptionint compare(Object[] rowData1, Object[] rowData2) throws KettleValueException
rowData1
- The first row of datarowData2
- The second row of data
KettleValueException
- the kettle value exceptionint oldXORHashCode(Object[] rowData) throws KettleValueException
rowData
- The data to calculate a hashCode with
KettleValueException
- in case there is a data conversion errorint hashCode(Object[] rowData) throws KettleValueException
rowData
- The data to calculate a hashCode with
KettleValueException
- in case there is a data conversion errorint convertedValuesHashCode(Object[] rowData) throws KettleValueException
rowData
- The data to calculate a hashCode with
KettleValueException
- in case there is a data conversion errorString toStringMeta()
String getMetaXML() throws IOException
IOException
- Thrown in case there is an (Base64/GZip) encoding problemString getDataXML(Object[] rowData) throws IOException
rowData
- the row of data to serialize as XML
IOException
- Thrown in case there is an (Base64/GZip) encoding problemObject[] getRow(Node node) throws KettleException
node
- The data row node
KettleException
- Thrown in case there is an (Base64/GZip) decoding problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |