org.squashtest.tm.tools.annotation.processor
Class DynamicComponentProcessor<ANNOTATION extends Annotation>

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by org.squashtest.tm.tools.annotation.processor.DynamicComponentProcessor<ANNOTATION>
All Implemented Interfaces:
Processor
Direct Known Subclasses:
DynamicDaoProcessor, DynamicManagerProcessor

public abstract class DynamicComponentProcessor<ANNOTATION extends Annotation>
extends AbstractProcessor

Author:
Gregory Fouquet

Field Summary
protected static String DYNAMIC_COMPONENT_TEMPLATE
           
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
DynamicComponentProcessor()
           
 
Method Summary
protected abstract  Class<ANNOTATION> annotationClass()
           
protected abstract  String beanFactoryClass()
           
protected abstract  String beanName(ANNOTATION componentDefinition)
          Should get the "name" property of the annotation.
protected  void checkSessionFactoryName(String name, Element component)
           
protected abstract  Class<?> entityClass(ANNOTATION componentDefinition)
          Should get the entity property of the given component definition.
protected abstract  String generatedFileName()
           
protected  Messager getMessager()
           
 void init(ProcessingEnvironment processingEnv)
           
protected abstract  boolean lookupCustomImplementation(ANNOTATION definition)
           
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment)
           
protected abstract  CharSequence sessionFactoryName(ANNOTATION definition, Element component)
          This method should issue an error if no sessionFactoryName is extractible from annotation.
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DYNAMIC_COMPONENT_TEMPLATE

protected static final String DYNAMIC_COMPONENT_TEMPLATE
See Also:
Constant Field Values
Constructor Detail

DynamicComponentProcessor

public DynamicComponentProcessor()
Method Detail

init

public final void init(ProcessingEnvironment processingEnv)
Specified by:
init in interface Processor
Overrides:
init in class AbstractProcessor

process

public final boolean process(Set<? extends TypeElement> annotations,
                             RoundEnvironment roundEnvironment)
Specified by:
process in interface Processor
Specified by:
process in class AbstractProcessor
See Also:
AbstractProcessor.process(java.util.Set, javax.annotation.processing.RoundEnvironment)

annotationClass

protected abstract Class<ANNOTATION> annotationClass()

entityClass

protected abstract Class<?> entityClass(ANNOTATION componentDefinition)
Should get the entity property of the given component definition. Which should puke a MirroredTypeException but it's OK.

Parameters:
componentDefinition -
Returns:

beanName

protected abstract String beanName(ANNOTATION componentDefinition)
Should get the "name" property of the annotation.

Parameters:
componentDefinition -
Returns:

beanFactoryClass

protected abstract String beanFactoryClass()

generatedFileName

protected abstract String generatedFileName()

lookupCustomImplementation

protected abstract boolean lookupCustomImplementation(ANNOTATION definition)
Parameters:
definition -
Returns:
whether dynamic component factory should lookup custom implementation or not.

sessionFactoryName

protected abstract CharSequence sessionFactoryName(ANNOTATION definition,
                                                   Element component)
This method should issue an error if no sessionFactoryName is extractible from annotation.

Parameters:
definition -
component -
Returns:
the bean name of the session factory which should be used.

getMessager

protected final Messager getMessager()
Returns:
the messager

checkSessionFactoryName

protected void checkSessionFactoryName(String name,
                                       Element component)


Copyright © 2010-2014 Henix, henix.fr. All Rights Reserved.