org.apache.openjpa.persistence.meta
Class AnnotationProcessor6
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.apache.openjpa.persistence.meta.AnnotationProcessor6
- All Implemented Interfaces:
- javax.annotation.processing.Processor
@SupportedAnnotationTypes(value={"javax.persistence.Entity","javax.persistence.Embeddable","javax.persistence.MappedSuperclass"})
@SupportedOptions(value={"log","out","source","naming","header"})
@SupportedSourceVersion(value=RELEASE_6)
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 specified in the compiler -processorpath
option.
Usage
$ javac -processorpath path/to/openjpa-all.jar mypackage/MyEntity.java
will generate source code for canonical meta-model class mypackage.MyEntity_.java
.
The Annotation Processor recognizes the following options (none of them are mandatory):
-Alog=TRACE|INFO|WARN|ERROR
The logging level. Default is WARN
.
-Asource=<n>
where <n> denotes the integral number for Java source version of the generated code.
Default is 6
.
-Anaming=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 to
org.apache.openjpa.persistence.PersistenceMetaDataFactory
which appends a underscore character
(_
) to the original Java class name.
-Aheader=<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.
-Aout=dir
A directory in the local file system. The generated files will be written relative to this directory
according to the package structure i.e. if dir
is specified as /myproject/generated-src
then the generated source code will be written to /myproject/generated-src/mypackage/MyEntity_.java
.
If this option is not specified, then an attempt will be made to write the generated source file in the same
directory of the source code of original class mypackage.MyEntity
. The source code location for
mypackage.MyEntity
can only be determined for Sun JDK6 and tools.jar
being available
to the compiler classpath. If the source code location for the original class can not be determined, and the
option is not specified, then the generated source code is written relative to the current directory according
to the package structure.
- Since:
- 2.0.0
- Author:
- Pinaki Poddar
Fields inherited from class javax.annotation.processing.AbstractProcessor |
processingEnv |
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 |
AnnotationProcessor6
public AnnotationProcessor6()
init
public void init(javax.annotation.processing.ProcessingEnvironment processingEnv)
- Initialization.
- Specified by:
init
in interface javax.annotation.processing.Processor
- Overrides:
init
in class javax.annotation.processing.AbstractProcessor
process
public boolean process(Set<? extends javax.lang.model.element.TypeElement> annos,
javax.annotation.processing.RoundEnvironment roundEnv)
- The entry point for java compiler.
- Specified by:
process
in interface javax.annotation.processing.Processor
- Specified by:
process
in class javax.annotation.processing.AbstractProcessor
Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.