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

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

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

Stores additional information for an ORFieldInfo of single-entry type. The single-entry field class should have an OR mapping, say childMapEntry, against a relational database table.

All key fields of this childMapEntry 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.SingleEntryTypeInfo(java.lang.String fieldTypeStr)
          Constructs a SingleEntryTypeInfo with given field type string.
 
Method Summary
 void addRelation(java.lang.String parentField, java.lang.String childField)
          Add an parent-child field relation to relation map.
 java.lang.Class getFieldClass()
          Returns the class associated with field's type.
 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 single-entry type.
 java.lang.String getTypeStr()
          Returns string representation of field's type/class.
 java.lang.String toString()
          Returns string representation of SingleEntryTypeInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ORFieldInfo.SingleEntryTypeInfo

public ORFieldInfo.SingleEntryTypeInfo(java.lang.String fieldTypeStr)
Constructs a SingleEntryTypeInfo with given field type string.
Method Detail

getTypeStr

public java.lang.String getTypeStr()
Returns string representation of field's type/class.

getFieldClass

public java.lang.Class getFieldClass()
                              throws java.lang.Exception
Returns the class associated with field's type.
Throws:
java.lang.Exception - if field class can not be located.

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 single-entry type field. This field name maps to a key field (childField) specified in mapping associated with the single-entry field class.
childField - A key field name specified in OR mapping associated with the single-entry field 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 single-entry type.
Returns:
Collection of all parent-child relations specified in OR mapping entry for this single-entry field. Returns null if relation map in empty.

toString

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