Class AnnotationProcessor6
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- org.apache.openjpa.persistence.meta.AnnotationProcessor6
-
- All Implemented Interfaces:
javax.annotation.processing.Processor
@SupportedAnnotationTypes({"jakarta.persistence.Entity","jakarta.persistence.Embeddable","jakarta.persistence.MappedSuperclass"}) @SupportedOptions({"openjpa.log","openjpa.source","openjpa.naming","openjpa.header","openjpa.metamodel","openjpa.addGeneratedAnnotation"}) public class AnnotationProcessor6 extends javax.annotation.processing.AbstractProcessor
Annotation processing tool generates source code for a meta-model class given the annotated source code of persistent entity.This tool is invoked during compilation for JDK6 compiler if
- OpenJPA and JPA libraries are available in the compiler classpath and
- Annotation Processor option
-Aopenjpa.metamodel=true
is specified.
Usage
$ javac -classpath path/to/openjpa-all.jar -Aopenjpa.metamodel=true mypackage/MyEntity.java
will generate source code for canonical meta-model classmypackage.MyEntity_.java
. The source code is generated relative to the directory specified in-s
option ofjavac
compiler and defaulted to the current directory.The Annotation Processor also recognizes the following options (none of them are mandatory):
-Aopenjpa.log={log level} The logging level. Default is WARN
. Permissible values areTRACE
,INFO
,WARN
orERROR
.-Aopenjpa.source={n} Java source version of the generated code. Default is 6
.-Aopenjpa.naming={class name} fully-qualified name of a class implementing org.apache.openjpa.meta.MetaDataFactory
that determines the name of a meta-class given the name of the original persistent Java entity class. Defaults toorg.apache.openjpa.persistence.PersistenceMetaDataFactory
which appends a underscore character (_
) to the original Java class name.-Aopenjpa.header={url} A url whose content will appear as comment header to the generated file(s). Recognizes special value ASL
for Apache Source License header as comment. By default adds a OpenJPA proprietary text.- Since:
- 2.0.0
- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description AnnotationProcessor6()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.lang.model.SourceVersion
getSupportedSourceVersion()
void
init(javax.annotation.processing.ProcessingEnvironment processingEnv)
Initialization.boolean
process(java.util.Set<? extends javax.lang.model.element.TypeElement> annos, javax.annotation.processing.RoundEnvironment roundEnv)
The entry point for java compiler.
-
-
-
Method Detail
-
getSupportedSourceVersion
public javax.lang.model.SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersion
in interfacejavax.annotation.processing.Processor
- Overrides:
getSupportedSourceVersion
in classjavax.annotation.processing.AbstractProcessor
-
init
public void init(javax.annotation.processing.ProcessingEnvironment processingEnv)
Initialization.- Specified by:
init
in interfacejavax.annotation.processing.Processor
- Overrides:
init
in classjavax.annotation.processing.AbstractProcessor
-
process
public boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> annos, javax.annotation.processing.RoundEnvironment roundEnv)
The entry point for java compiler.- Specified by:
process
in interfacejavax.annotation.processing.Processor
- Specified by:
process
in classjavax.annotation.processing.AbstractProcessor
-
-