@Experimental public class BeamRecord extends java.lang.Object implements java.io.Serializable
BeamRecord
is an immutable tuple-like type to represent one element in a
PCollection
. The fields are described with a BeamRecordType
.
By default, BeamRecordType
only contains the name for each field. It
can be extended to support more sophisticated validation by overwriting
BeamRecordType.validateValueType(int, Object)
.
A Coder BeamRecordCoder
is provided, which wraps the Coder for each data field.
Constructor and Description |
---|
BeamRecord(BeamRecordType dataType,
java.util.List<java.lang.Object> rawDataValues)
Creates a BeamRecord.
|
BeamRecord(BeamRecordType dataType,
java.lang.Object... rawdataValues)
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.math.BigDecimal |
getBigDecimal(int idx)
Get a
BigDecimal value by field index, ClassCastException is thrown
if type doesn't match. |
java.math.BigDecimal |
getBigDecimal(java.lang.String fieldName)
Get a
BigDecimal value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Boolean |
getBoolean(int idx)
Get a
Boolean value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Boolean |
getBoolean(java.lang.String fieldName)
Get a
Boolean value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Byte |
getByte(int idx)
Get a
Byte value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Byte |
getByte(java.lang.String fieldName)
Get a
Byte value by field name, ClassCastException is thrown
if type doesn't match. |
BeamRecordType |
getDataType()
Return
BeamRecordType which describes the fields. |
java.util.List<java.lang.Object> |
getDataValues()
Return the list of data values.
|
java.util.Date |
getDate(int idx)
Get a
Date value by field index, ClassCastException is thrown
if type doesn't match. |
java.util.Date |
getDate(java.lang.String fieldName)
Get a
Date value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Double |
getDouble(int idx)
Get a
Double value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Double |
getDouble(java.lang.String fieldName)
Get a
Double value by field name, ClassCastException is thrown
if type doesn't match. |
int |
getFieldCount()
Return the size of data fields.
|
java.lang.Object |
getFieldValue(int fieldIdx)
Get value by field index.
|
java.lang.Object |
getFieldValue(java.lang.String fieldName)
Get value by field name.
|
java.lang.Float |
getFloat(int idx)
Get a
Float value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Float |
getFloat(java.lang.String fieldName)
Get a
Float value by field name, ClassCastException is thrown
if type doesn't match. |
java.util.GregorianCalendar |
getGregorianCalendar(int idx)
Get a
GregorianCalendar value by field index, ClassCastException is thrown
if type doesn't match. |
java.util.GregorianCalendar |
getGregorianCalendar(java.lang.String fieldName)
Get a
GregorianCalendar value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Integer |
getInteger(int idx)
Get a
Integer value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Integer |
getInteger(java.lang.String fieldName)
Get a
Integer value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Long |
getLong(int idx)
Get a
Long value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Long |
getLong(java.lang.String fieldName)
Get a
Long value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.Short |
getShort(int idx)
Get a
Short value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.Short |
getShort(java.lang.String fieldName)
Get a
Short value by field name, ClassCastException is thrown
if type doesn't match. |
java.lang.String |
getString(int idx)
Get a
String value by field index, ClassCastException is thrown
if type doesn't match. |
java.lang.String |
getString(java.lang.String fieldName)
Get a
String value by field name, ClassCastException is thrown
if type doesn't match. |
int |
hashCode() |
java.lang.String |
toString() |
public BeamRecord(BeamRecordType dataType, java.util.List<java.lang.Object> rawDataValues)
dataType
- type of the recordrawDataValues
- values of the record, record's size must match size of
the BeamRecordType
, or can be null, if it is null
then every field is null.public BeamRecord(BeamRecordType dataType, java.lang.Object... rawdataValues)
public java.lang.Object getFieldValue(java.lang.String fieldName)
public java.lang.Byte getByte(java.lang.String fieldName)
Byte
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Short getShort(java.lang.String fieldName)
Short
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Integer getInteger(java.lang.String fieldName)
Integer
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Float getFloat(java.lang.String fieldName)
Float
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Double getDouble(java.lang.String fieldName)
Double
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Long getLong(java.lang.String fieldName)
Long
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.String getString(java.lang.String fieldName)
String
value by field name, ClassCastException
is thrown
if type doesn't match.public java.util.Date getDate(java.lang.String fieldName)
Date
value by field name, ClassCastException
is thrown
if type doesn't match.public java.util.GregorianCalendar getGregorianCalendar(java.lang.String fieldName)
GregorianCalendar
value by field name, ClassCastException
is thrown
if type doesn't match.public java.math.BigDecimal getBigDecimal(java.lang.String fieldName)
BigDecimal
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Boolean getBoolean(java.lang.String fieldName)
Boolean
value by field name, ClassCastException
is thrown
if type doesn't match.public java.lang.Object getFieldValue(int fieldIdx)
public java.lang.Byte getByte(int idx)
Byte
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Short getShort(int idx)
Short
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Integer getInteger(int idx)
Integer
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Float getFloat(int idx)
Float
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Double getDouble(int idx)
Double
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Long getLong(int idx)
Long
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.String getString(int idx)
String
value by field index, ClassCastException
is thrown
if type doesn't match.public java.util.Date getDate(int idx)
Date
value by field index, ClassCastException
is thrown
if type doesn't match.public java.util.GregorianCalendar getGregorianCalendar(int idx)
GregorianCalendar
value by field index, ClassCastException
is thrown
if type doesn't match.public java.math.BigDecimal getBigDecimal(int idx)
BigDecimal
value by field index, ClassCastException
is thrown
if type doesn't match.public java.lang.Boolean getBoolean(int idx)
Boolean
value by field index, ClassCastException
is thrown
if type doesn't match.public int getFieldCount()
public java.util.List<java.lang.Object> getDataValues()
public BeamRecordType getDataType()
BeamRecordType
which describes the fields.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object