Package guru.mikelue.jdut.datagrain
Class DataRow
- java.lang.Object
-
- guru.mikelue.jdut.datagrain.DataRow
-
public class DataRow extends Object
Represents the data of a row.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDataRow.BuilderUsed withDataRow.build(Consumer<DataRow.Builder>).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataRowbuild(Consumer<DataRow.Builder> builderConsumer)Builds row byConsumerofDataRow.Builder.static DataRowbuild(Consumer<DataRow.Builder> builderConsumer, DataRow existingRow)Builds row byConsumerofDataRow.Builderand existing row.protected DataRowclone()booleanequals(Object obj)Compares the table schema and data.<T> TgetAttribute(String name)Gets attribute of this row.List<String>getColumns()Gets name of columns.<T> TgetData(String columnName)Gets the data by column name.<T> DataField<T>getDataField(String columnName)Gets the field by column name.SchemaTablegetTable()Gets the table schema.booleanhasAttribute(String name)Checks whether or not a attribute is existing.inthashCode()Hashes the table schema and data.booleanisValidated()Whether or not this row is validated with schema of table.voidputAttribute(String name, Object value)Puts a attribute.voidvalidate()Validates the data of row with schema information fromgetTable().
-
-
-
Method Detail
-
build
public static DataRow build(Consumer<DataRow.Builder> builderConsumer)
Builds row byConsumerofDataRow.Builder.- Parameters:
builderConsumer- The consumer to build row- Returns:
- the built data of row
-
build
public static DataRow build(Consumer<DataRow.Builder> builderConsumer, DataRow existingRow)
Builds row byConsumerofDataRow.Builderand existing row.- Parameters:
builderConsumer- The consumer to build rowexistingRow- The row to be modified- Returns:
- the built data of row
-
getTable
public SchemaTable getTable()
Gets the table schema.- Returns:
- table schema
-
getDataField
public <T> DataField<T> getDataField(String columnName)
Gets the field by column name.- Type Parameters:
T- The type of field- Parameters:
columnName- The name of column- Returns:
- The field with the column name
- Throws:
IllegalArgumentException- If the is no such field found with the column name- See Also:
getData(java.lang.String)
-
getData
public <T> T getData(String columnName)
Gets the data by column name.- Type Parameters:
T- The type of data- Parameters:
columnName- The name of column- Returns:
- The field with the column name
- Throws:
IllegalArgumentException- If the is no such field found with the column name- See Also:
getDataField(java.lang.String)
-
validate
public void validate() throws DataRowExceptionValidates the data of row with schema information fromgetTable().- Throws:
DataRowException- The exception if the validation is failed- See Also:
isValidated()
-
isValidated
public boolean isValidated()
Whether or not this row is validated with schema of table.- Returns:
- true if validated
- See Also:
validate()
-
getAttribute
public <T> T getAttribute(String name)
Gets attribute of this row.- Type Parameters:
T- The expected type of result- Parameters:
name- The name of attribute- Returns:
- null if attribute is not existing
- See Also:
hasAttribute(java.lang.String),putAttribute(java.lang.String, java.lang.Object)
-
hasAttribute
public boolean hasAttribute(String name)
Checks whether or not a attribute is existing.- Parameters:
name- The name of attribute- Returns:
- true if the attribute is existing
- See Also:
getAttribute(java.lang.String),putAttribute(java.lang.String, java.lang.Object)
-
putAttribute
public void putAttribute(String name, Object value)
Puts a attribute.- Parameters:
name- The name of attributevalue- the value of attribute- See Also:
getAttribute(java.lang.String),hasAttribute(java.lang.String)
-
hashCode
public int hashCode()
Hashes the table schema and data.
-
-