com.nec.tdd.tools.dbMapper
Class ORFieldInfo.MultipleEntryTypeInfo

java.lang.Object
  |
  +--com.nec.tdd.tools.dbMapper.ORFieldInfo.MultipleEntryTypeInfo
Enclosing class:
ORFieldInfo

public static class ORFieldInfo.MultipleEntryTypeInfo
extends java.lang.Object

Stores additional information for an ORFieldInfo of multiple-entry type.

A multiple-entry can be of one of the following two types:

Component class (contained in Array or collection) should have an OR mapping, say componentMapEntry, against a relational database table. All key fields of this componentMapEntry are mapped to basic fields of parentMapEntry (mapping to which contains this ORFieldInfo). This class maintains a map of these parent-child pairs indexed by parent field name.


Constructor Summary
ORFieldInfo.MultipleEntryTypeInfo(java.lang.String fieldTypeStr, java.lang.String containerTypeStr)
          Constructs a MultipleEntryTypeInfo with given component and container types.
 
Method Summary
 void addRelation(java.lang.String parentField, java.lang.String childField)
          Add an parent-child field relation to relation map.
 java.lang.Class getContainerClass()
          Returns the container class associated with this multiple-entry.
 java.lang.String getContainerTypeStr()
          Returns container class name as specified in mapping file.
 java.lang.Class getEntryClass()
          Returns the component class associated with this multiple-entry.
 java.lang.String getEntryTypeStr()
          Returns component class name.
 java.lang.String getRelation(java.lang.String parentField)
          Get child field name associated with given parent field name from parent-child relation map.
 java.util.Collection getRelations()
          Get all parent-child relation pair from the relation map associated with this multiple-entry type.
 java.lang.String toString()
          Returns string representation of MultipleEntryTypeInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ORFieldInfo.MultipleEntryTypeInfo

public ORFieldInfo.MultipleEntryTypeInfo(java.lang.String fieldTypeStr,
                                         java.lang.String containerTypeStr)
Constructs a MultipleEntryTypeInfo with given component and container types.
Method Detail

getEntryTypeStr

public java.lang.String getEntryTypeStr()
Returns component class name.

getEntryClass

public java.lang.Class getEntryClass()
                              throws java.lang.Exception
Returns the component class associated with this multiple-entry.
Throws:
java.lang.Exception - if class can not be loaded.

getContainerTypeStr

public java.lang.String getContainerTypeStr()
Returns container class name as specified in mapping file. For array multiple-entry type, the name should end with "[]". For a collection map-entry, class name should be a derived (non-abstract) class of java.util.Collection class.

getContainerClass

public java.lang.Class getContainerClass()
                                  throws java.lang.Exception
Returns the container class associated with this multiple-entry. For array multiple-entry case, it returns the class corresponding to a java.lang.Array object with component of type getEntryClass(). For collection map-entry case, container class (a derived class of java.util.Collection) is returned.
Throws:
java.lang.Exception - if class can not be loaded.

addRelation

public void addRelation(java.lang.String parentField,
                        java.lang.String childField)
Add an parent-child field relation to relation map.
Parameters:
parentField - A basic field name from mapping which holds this ORFieldInfo. This field name maps to a key field (childField) specified in mapping associated with the component type/class.
childField - A key field name specified in OR mapping associated with the multiple-entry component class.

getRelation

public java.lang.String getRelation(java.lang.String parentField)
Get child field name associated with given parent field name from parent-child relation map.
Parameters:
parentField - The parent field name (a basic field name from mapping which holds the ORFieldInfo).
Returns:
The child field name associated with the given parent field from relation map. Returns null if no matching entry is found.

getRelations

public java.util.Collection getRelations()
Get all parent-child relation pair from the relation map associated with this multiple-entry type.
Returns:
Collection of all parent-child relations specified in OR mapping entry for this multiple-entry field. Returns null if relation map in empty.

toString

public java.lang.String toString()
Returns string representation of MultipleEntryTypeInfo.
Overrides:
toString in class java.lang.Object