org.jlf.dataMap
Class DataArray

java.lang.Object
  |
  +--org.jlf.dataMap.DataArray

public class DataArray
extends java.lang.Object

This class is used to hold one row of data read in from a data mapper. It contains the row meta data and data, so DataMappedObjects can construct themselves and their relationships from it.

See Also:
DataMapper, DataMappedObject

Field Summary
protected  java.util.Vector columnNames
          Holds a vector of column names
protected  java.lang.Object[] columnValues
          Holds an array of column values corresponding to the column names.
protected  DataMapper dataMapper
          Holds the DataMapper that created this object.
 
Constructor Summary
protected DataArray()
          Protect the default constructor, must use a parameterized constructor!
  DataArray(DataMapper dataMapper, java.util.Vector columnNames)
          Create a new object given column meta data (column names) in an ordered Vector.
 
Method Summary
 int columnNumberForColumnName(java.lang.String columnName)
          Retrieves the column number of the column name given as input (finds the first one if more than one of the same name).
 java.lang.Object getColumnValue(DataMappedObject dmo, java.lang.String columnName, Relationship relationship)
          Retrieves a value for a DataMappedObject if its value can be found in the array.
 java.lang.Object getColumnValue(int columnNumber)
          Retrieves the column value for the column number given.
 DataLocation getDataLocation()
          Returns the data location this DataArray was read from.
 int getNumberOfColumns()
          Returns the number of columns in the column name vector.
 boolean hasColumnValue(DataMappedObject dmo, java.lang.String columnName, Relationship relationship)
          Looks to see if the data attribute has an alias defined in the DataLocation mapping properties.
 void putColumnValue(int columnNumber, java.lang.Object value)
          Puts a value into the vector of column values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataMapper

protected DataMapper dataMapper
Holds the DataMapper that created this object.


columnNames

protected java.util.Vector columnNames
Holds a vector of column names


columnValues

protected java.lang.Object[] columnValues
Holds an array of column values corresponding to the column names. Indexes to the column name match the vector, starting at zero!

Constructor Detail

DataArray

protected DataArray()
Protect the default constructor, must use a parameterized constructor!


DataArray

public DataArray(DataMapper dataMapper,
                 java.util.Vector columnNames)
Create a new object given column meta data (column names) in an ordered Vector.

Method Detail

getNumberOfColumns

public int getNumberOfColumns()
Returns the number of columns in the column name vector.


getDataLocation

public DataLocation getDataLocation()
Returns the data location this DataArray was read from.


putColumnValue

public void putColumnValue(int columnNumber,
                           java.lang.Object value)
Puts a value into the vector of column values.


columnNumberForColumnName

public int columnNumberForColumnName(java.lang.String columnName)
Retrieves the column number of the column name given as input (finds the first one if more than one of the same name).

Returns:
positive number of column position if found, -1 if not.

getColumnValue

public java.lang.Object getColumnValue(int columnNumber)
Retrieves the column value for the column number given.


hasColumnValue

public boolean hasColumnValue(DataMappedObject dmo,
                              java.lang.String columnName,
                              Relationship relationship)
Looks to see if the data attribute has an alias defined in the DataLocation mapping properties. If input relationship is null, the method looks for an attribute alias for the current data mapped object. If relationship is populated, it looks for a qualified relationship attribute alias.


getColumnValue

public java.lang.Object getColumnValue(DataMappedObject dmo,
                                       java.lang.String columnName,
                                       Relationship relationship)
Retrieves a value for a DataMappedObject if its value can be found in the array. Looks to see if the data attribute has an alias defined in the DataLocation mapping properties. If input relationship is null, the method looks for an attribute alias for the current data mapped object. If relationship is populated, it looks for a qualified relationship attribute alias.