org.sormula.annotation
Class ExplicitTypeAnnotationReader

java.lang.Object
  extended by org.sormula.annotation.ExplicitTypeAnnotationReader

public class ExplicitTypeAnnotationReader
extends java.lang.Object

Reads ExplicitType annotations from classes. The first ExplicitType annotation found for a class is used. If ExplicitType is already defined for a class type, then it is ignored.

Since:
1.6 and 2.0
Author:
Jeff Miller

Constructor Summary
ExplicitTypeAnnotationReader(TypeTranslatorMap typeTranslatorMap, java.lang.Class<?>... sources)
          Constructs for classes that may contain the annotation.
 
Method Summary
 void install()
          Reads ExplicitType annotations from sources and adds them to type map if they are not already defined.
protected  void updateMap(ExplicitType typeAnnotation)
          Adds a new instance of TypeTranslator to type translator map if not already defined for ExplicitType.type().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExplicitTypeAnnotationReader

public ExplicitTypeAnnotationReader(TypeTranslatorMap typeTranslatorMap,
                                    java.lang.Class<?>... sources)
Constructs for classes that may contain the annotation.

Parameters:
typeTranslatorMap - a class that implements TypeTranslatorMap; typically Database and Table
sources - classes that contain ExplicitType or ExplicitTypes annotations
Method Detail

install

public void install()
             throws java.lang.Exception
Reads ExplicitType annotations from sources and adds them to type map if they are not already defined.

Throws:
java.lang.Exception - if error creating TypeTranslator

updateMap

protected void updateMap(ExplicitType typeAnnotation)
                  throws java.lang.Exception
Adds a new instance of TypeTranslator to type translator map if not already defined for ExplicitType.type().

Versions prior to 1.9.2 did not allow type translators to be replaced. Starting with version 1.9.2 and 2.3.2, this method will replace existing type translator with new one ExplicitType.translator() is different from existing.

Parameters:
typeAnnotation - definition of type to add
Throws:
java.lang.Exception - if error creating new instance of TypeTranslator