ru.sstu.tables
Class Mapping<T>

java.lang.Object
  extended by ru.sstu.tables.Mapping<T>
Type Parameters:
T - Java Bean type
Direct Known Subclasses:
AnnotationMapping, ArrayMapping, XmlMapping

public abstract class Mapping<T>
extends Object

Mapping class is used for mapping between Java Bean properties and columns of table.

Since:
Tables 1.0
Author:
Denis_Murashev

Constructor Summary
Mapping()
           
 
Method Summary
protected  void addField(int index, Field field)
          Adds mapping.
protected  void addField(int index, Field field, String value)
          Adds mapping.
protected  void checkIndex(int index)
          Checks if given index is the greatest.
protected  T createObject()
          Creates new mapped object instance.
protected  int getMaxIndex()
           
 int getSkipRows()
           
 int getTableIndex()
           
protected  TableReader getTableReader()
          Provides table reader.
protected  Class<T> getType()
           
protected  void setClass(Class<T> type)
           
 void setSkipRows(int skipRows)
           
 void setTableIndex(int tableIndex)
           
protected  void setTableReader(TableReader reader)
          Sets current table reader.
protected  void setValue(T object, int index, Object value)
          Sets value to the Java Bean field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapping

public Mapping()
Method Detail

getTableIndex

public int getTableIndex()
Returns:
the tableIndex
Since:
Tables 1.1

setTableIndex

public void setTableIndex(int tableIndex)
Parameters:
tableIndex - the tableIndex to set
Since:
Tables 1.1

getSkipRows

public int getSkipRows()
Returns:
the skipRows
Since:
Tables 1.1

setSkipRows

public void setSkipRows(int skipRows)
Parameters:
skipRows - the skipRows to set
Since:
Tables 1.1

getTableReader

protected TableReader getTableReader()
Provides table reader.

Returns:
table reader

setTableReader

protected void setTableReader(TableReader reader)
Sets current table reader.

Parameters:
reader - table reader

createObject

protected T createObject()
                  throws TableException
Creates new mapped object instance.

Returns:
new object instance
Throws:
TableException - if cannot create object

setValue

protected void setValue(T object,
                        int index,
                        Object value)
                 throws TableException
Sets value to the Java Bean field.

Parameters:
object - Java Bean object
index - table column index
value - value to be set
Throws:
TableException - if cannot set value

getMaxIndex

protected int getMaxIndex()
Returns:
max column index

getType

protected Class<T> getType()
Returns:
class

setClass

protected void setClass(Class<T> type)
Parameters:
type - class type

addField

protected void addField(int index,
                        Field field)
Adds mapping.

Parameters:
index - column index
field - field

addField

protected void addField(int index,
                        Field field,
                        String value)
Adds mapping.

Parameters:
index - column index
field - field
value - default value
Since:
Tables 1.1

checkIndex

protected void checkIndex(int index)
Checks if given index is the greatest.

Parameters:
index - index


Copyright © 2012 TFI branch of Engels Instutute of Technology. All Rights Reserved.