com.nec.tdd.tools.dbMapper
Class ORMappingInfo

java.lang.Object
  |
  +--com.nec.tdd.tools.dbMapper.ORMappingInfo

public class ORMappingInfo
extends java.lang.Object

This class maintains the mappings between Java classes that an application will use, and the relational database tables that will be used to store object instances of them.

It stores OR mapping entries (instances of type ORMapEntry) in a map indexed by user class names. New mapping entries can be added dynamically by manually constructing an ORMapEntry object.


Constructor Summary
ORMappingInfo()
          Constructs an empty ORMappingInfo object.
 
Method Summary
 ORMapEntry add(ORMapEntry mapEntry)
          Add an ORMapEntry to the ORMappingInfo map.
 void addAll(ORMappingInfo newMappings)
          Copies all of the O-R mappings (ORMapEntry objects) from the specified ORMappingInfo, named newMappings, to this ORMappingInfo.
 ORMapEntry get(java.lang.Class cls)
          Get an ORMapEntry associated with given user class.
 ORMapEntry get(java.lang.String className)
          Get an ORMapEntry associated with given class name.
 ORMapEntry[] getAll()
          Get all OR mapping entries associated with this ORMappingInfo object.
 java.lang.String toString()
          Returns string representation of ORMappingInfo, containing the string representation of each mapping entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ORMappingInfo

public ORMappingInfo()
Constructs an empty ORMappingInfo object. New mapping entries can be added manually using add method.
Method Detail

get

public ORMapEntry get(java.lang.Class cls)
Get an ORMapEntry associated with given user class.
Parameters:
cls - User class whose associated mapping entry is to be returned.
Returns:
the mapping entry to which the class is mapped. Returns null if no mapping for the class.

get

public ORMapEntry get(java.lang.String className)
Get an ORMapEntry associated with given class name.
Parameters:
className - User class name whose associated mapping entry is to be returned.
Returns:
the mapping entry to which the class name is mapped. Returns null if no mapping for the class.

getAll

public ORMapEntry[] getAll()
Get all OR mapping entries associated with this ORMappingInfo object.
Returns:
Returns an array containing all of the mapping entries in this ORMappingInfo.

add

public ORMapEntry add(ORMapEntry mapEntry)
Add an ORMapEntry to the ORMappingInfo map. If an entry with same class name exists, old entry is overwritten by this new entry. Note: Only one mapping is allowed for a given class. So all other class mappings referring to this class from now on will start using this new mapping object.
Parameters:
mapEntry - map entry to be inserted.

addAll

public void addAll(ORMappingInfo newMappings)
Copies all of the O-R mappings (ORMapEntry objects) from the specified ORMappingInfo, named newMappings, to this ORMappingInfo. These new mappings will replace any mappings that this ORMappingInfo had for any of the keys currently in the specified map.
Parameters:
newMappings - new mappings to be stored in this ORMappingInfo

toString

public java.lang.String toString()
Returns string representation of ORMappingInfo, containing the string representation of each mapping entry.
Overrides:
toString in class java.lang.Object