org.jcon.data
Class FieldTranslator

java.lang.Object
  extended by org.jcon.data.TranslatingMap
      extended by org.jcon.data.FieldTranslator
All Implemented Interfaces:
java.util.Map

public abstract class FieldTranslator
extends TranslatingMap

This is a TranslatingMap whose sole purpose is the translation of a field set (the output of fields()) for one type of Record to the corresponding field set for another type.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
FieldTranslator(java.util.Map source, java.util.Map old2NewMapping, java.util.Map new2OldMapping, java.util.Map oldFields, java.util.Map newFields)
          Creates a new FieldTranslator.
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          Gets the object associated with the specified key in the Map.
protected abstract  java.lang.Object translate(FieldDef oldDef, FieldDef newDef, java.lang.Object oldElement)
          Subclasses should override this
protected  java.lang.Object translateElement(java.lang.Object element)
           
protected  java.lang.Object translateKey(java.lang.Object key)
           
 
Methods inherited from class org.jcon.data.TranslatingMap
clear, containsKey, containsValue, elements, entrySet, getSource, isEmpty, keys, keySet, put, putAll, remove, size, translateMapping, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

FieldTranslator

public FieldTranslator(java.util.Map source,
                       java.util.Map old2NewMapping,
                       java.util.Map new2OldMapping,
                       java.util.Map oldFields,
                       java.util.Map newFields)
Creates a new FieldTranslator.

Parameters:
source - the source fields Map
old2NewMapping - maps old field names to new field names
new2OldMapping - maps new field names to old field names
oldFields - old FieldDefs hashed by name
newFields - new FieldDefs hashed by name
Method Detail

translateKey

protected java.lang.Object translateKey(java.lang.Object key)
Overrides:
translateKey in class TranslatingMap

translateElement

protected java.lang.Object translateElement(java.lang.Object element)
Overrides:
translateElement in class TranslatingMap

get

public java.lang.Object get(java.lang.Object key)
Description copied from class: TranslatingMap
Gets the object associated with the specified key in the Map.

Specified by:
get in interface java.util.Map
Overrides:
get in class TranslatingMap
Parameters:
key - the key in the hash table
See Also:
Map.put(K, V)

translate

protected abstract java.lang.Object translate(FieldDef oldDef,
                                              FieldDef newDef,
                                              java.lang.Object oldElement)
Subclasses should override this