|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.scooterframework.orm.sqldataexpress.object.RowData
public class RowData
RowData class represents a row in TableData object.
Constructor Summary | |
---|---|
RowData(RowInfo rowInfo,
java.lang.Object[] data)
|
Method Summary | |
---|---|
void |
addChildRowToMap(java.lang.String key,
java.util.List<RowData> childRowList)
adds a list of child RowData objects to Map |
void |
addChildRowToMap(java.lang.String key,
RowData childRow)
adds a child RowData object to Map |
void |
clearAndSetData(java.util.Map<java.lang.String,?> inputDataMap)
Clears all existing data and resets data from a Map. |
void |
clearData()
Clears all existing data except the primary key data. |
java.util.List<RowData> |
getChildRowListFromMap(java.lang.String key)
returns a list of RowData objects for a child from Map |
java.util.Map<java.lang.String,java.lang.Object> |
getDataMap()
returns the data as a readonly Map. |
java.util.Map<java.lang.String,java.lang.Object> |
getDataMap(java.util.List<java.lang.String> columnNames)
returns the data as a readonly Map. |
java.lang.Object |
getField(int index)
Returns column data for a column index index: 0, 1, 2, ... |
java.lang.Object |
getField(java.lang.String columnName)
Returns column data for a column name |
java.lang.Object[] |
getFields()
returns plain data |
java.util.Map<java.lang.String,java.lang.Object> |
getPrimaryKeyDataMap()
returns primary key data as a readonly Map. |
java.lang.String |
getPrimaryKeyDataString()
returns primary key data as a string which comes from the primary key data map. |
java.lang.String |
getRestfulId()
Returns the restified id of the resource. |
java.util.Map<java.lang.String,java.lang.Object> |
getRestfulIdMap()
Returns the data map for the restified id. |
java.lang.String[] |
getRestfulIdNames()
Returns column names corresponding to the RESTful id. |
RowInfo |
getRowInfo()
returns row meta data |
int |
getSize()
returns columnSize |
boolean |
hasInitialized()
Checks if the record is initialized. |
boolean |
hasPrimaryKey()
Indicates if there is primary key defined. |
java.util.List<java.lang.String> |
setData(java.util.Map<java.lang.String,?> inputDataMap)
Sets data from a Map. |
void |
setField(int index,
java.lang.Object columnData)
Sets column data for a column index index: 0, 1, 2, ... |
void |
setField(java.lang.String columnName,
java.lang.Object columnData)
Sets column data for a column name If there is no such a columnName, an InvalidColumnNameException will be thrown. |
void |
setFields(java.lang.Object[] data)
Sets data. |
void |
setRestfulId(java.lang.String id)
Sets the id value of the resource. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RowData(RowInfo rowInfo, java.lang.Object[] data)
Method Detail |
---|
public java.lang.String getRestfulId()
Returns the restified id of the resource.
By default, this method returns a string of the primary key value of
the record. If the primary key is a composite key, a separator
(DatabaseConfig.PRIMARY_KEY_SEPARATOR
) is used
to link values of the key fields. The order of the fields of a composite
primary key is defined by the getRestfulIdNames
method.
If the underlying data does not have primary key, null is returned.
Subclass may override this method if a customized string format is required.
getRestfulId
in interface RESTified
public java.lang.String[] getRestfulIdNames()
getRestfulIdNames
in interface RESTified
public java.util.Map<java.lang.String,java.lang.Object> getRestfulIdMap()
getRestfulIdMap
in interface RESTified
public void setRestfulId(java.lang.String id)
Sets the id value of the resource. The format of the id string must
follow the pattern of the corresponding id config. If the id is backed
by a composite primary key, a separator
(DatabaseConfig.PRIMARY_KEY_SEPARATOR
)
must be used to link values of each primary key column.
Examples: id string id config array description --------- --------------- ------- 0001 [id] an order 0001-99 [order_id, id] an item of an order
setRestfulId
in interface RESTified
id
- public java.lang.Object[] getFields()
public void setFields(java.lang.Object[] data)
Sets data.
The order of values in the data array must be the same as the order of column names in the RowInfo object of this RowData instance.
public java.lang.Object getField(int index)
public void setField(int index, java.lang.Object columnData)
public java.lang.Object getField(java.lang.String columnName)
public void setField(java.lang.String columnName, java.lang.Object columnData)
public RowInfo getRowInfo()
public void clearData()
public void clearAndSetData(java.util.Map<java.lang.String,?> inputDataMap)
public java.util.List<java.lang.String> setData(java.util.Map<java.lang.String,?> inputDataMap)
Sets data from a Map.
The key of the data entry in the Map is corresponding to a
column name in the RowInfo object. If the key is not a column name, its
value is ignored. If the column name is not in the key set of the
Map, the column data is not updated. To set those column data
to null when the column name is not in the key set, use the
setField
method.
This method is restrictive. If a column is readonly, or not writable,
or is primary key, then the data for the column in the
inputDataMap is ignored. In that case, use the
setField
method
public java.util.Map<java.lang.String,java.lang.Object> getDataMap()
public java.util.Map<java.lang.String,java.lang.Object> getDataMap(java.util.List<java.lang.String> columnNames)
public java.util.Map<java.lang.String,java.lang.Object> getPrimaryKeyDataMap()
public java.lang.String getPrimaryKeyDataString()
public boolean hasPrimaryKey()
public boolean hasInitialized()
public int getSize()
public java.util.List<RowData> getChildRowListFromMap(java.lang.String key)
public void addChildRowToMap(java.lang.String key, RowData childRow)
public void addChildRowToMap(java.lang.String key, java.util.List<RowData> childRowList)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |