Top Description Inners Fields Constructors Methods
com.jogamp.gluegen.structgen

public Class CStructAnnotationProcessor

extends AbstractProcessor
Class Inheritance
Annotations
@SupportedAnnotationTypes:CStruct, CStructs
@SupportedSourceVersion:RELEASE_6
Imports
com.jogamp.common.util.PropertyAccess, com.jogamp.gluegen.GlueGen, .JavaEmitter, java.io.BufferedReader, .File, .FileNotFoundException, .FileReader, .FileWriter, .IOException, .PrintWriter, .Reader, java.util.ArrayList, .HashSet, .List, .Set, javax.annotation.processing.AbstractProcessor, .Filer, .Messager, .ProcessingEnvironment, .RoundEnvironment, .SupportedAnnotationTypes, .SupportedSourceVersion, javax.lang.model.SourceVersion, javax.lang.model.element.Element, .TypeElement, javax.lang.model.util.Elements, javax.tools.Diagnostic.Kind, .FileObject, .StandardLocation, jogamp.common.Debug

If the header file is absolute, the root path is the parent folder of the folder containing the package source, i.e.:

 Header: /gluegen/src/junit/com/jogamp/test/structgen/TestStruct01.h
 Root:   /gluegen/src/junit/..
 Root:   /gluegen/src
Otherwise the user.dir is being used as the root path and the relative header file is appended to it.

The property jogamp.gluegen.structgen.output allows setting a default outputPath for the generated sources, if the ProcessingEnvironment's structgen.output option is not set.

If the outputPath is relative, it is appended to the root path, otherwise it is taken as-is.

User can enable DEBUG while defining property jogamp.gluegen.structgen.debug.

Author
Michael Bien, et al.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
private static final String
private Elements
private Filer
private static final Set<String>
private Messager
private String
private static final String
private static final String
Inherited from javax.annotation.processing.AbstractProcessor:
processingEnv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
generateStructBinding(final Element element, final CStruct struct, final boolean isPackageOrType, final String rootOut, final String pakage, final File header, final String headerParent)

public void
init(final ProcessingEnvironment
environment to access facilities the tool framework provides to the processor
processingEnv
)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Initializes the processor with the processing environment.
private File
locateSource(final String packageName, final String relativeName)

public boolean
process(final Set<? extends TypeElement>
the annotation interfaces requested to be processed
annotations
,
final RoundEnvironment
environment for information about the current and prior round
env
)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor.
private void
processCStruct(final CStruct struct, final Element element, final String packageName, final String user_dir)

Inherited from javax.annotation.processing.AbstractProcessor:
getCompletionsgetSupportedAnnotationTypesgetSupportedOptionsgetSupportedSourceVersionisInitialized

Field Detail

DEBUGback to summary
pack-priv static final boolean DEBUG
DEFAULTback to summary
private static final String DEFAULT
eltUtilsback to summary
private Elements eltUtils
filerback to summary
private Filer filer
generatedStructsback to summary
private static final Set<String> generatedStructs
messagerback to summary
private Messager messager
outputPathback to summary
private String outputPath
STRUCTGENOUTPUTback to summary
private static final String STRUCTGENOUTPUT
STRUCTGENOUTPUT_OPTIONback to summary
private static final String STRUCTGENOUTPUT_OPTION

Constructor Detail

CStructAnnotationProcessorback to summary
public CStructAnnotationProcessor()

Method Detail

generateStructBindingback to summary
private void generateStructBinding(final Element element, final CStruct struct, final boolean isPackageOrType, final String rootOut, final String pakage, final File header, final String headerParent) throws IOException
initback to summary
public void init(final ProcessingEnvironment processingEnv)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Doc from javax.annotation.processing.AbstractProcessor.init.

Initializes the processor with the processing environment.

Parameters
processingEnv:ProcessingEnvironment

environment to access facilities the tool framework provides to the processor

Annotations
@Override
locateSourceback to summary
private File locateSource(final String packageName, final String relativeName)
processback to summary
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment env)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Doc from javax.annotation.processing.AbstractProcessor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor. If true is returned, the annotation interfaces are claimed and subsequent processors will not be asked to process them; if false is returned, the annotation interfaces are unclaimed and subsequent processors may be asked to process them. A processor may always return the same boolean value or may vary the result based on its own chosen criteria.

The input set will be empty if the processor supports "*" and the root elements have no annotations. A Processor must gracefully handle an empty set of annotations.

Parameters
annotations:Set<? extends TypeElement>

the annotation interfaces requested to be processed

env:RoundEnvironment

environment for information about the current and prior round

Returns:boolean

Doc from javax.annotation.processing.Processor.process.

whether or not the set of annotation interfaces are claimed by this processor

Annotations
@Override
processCStructback to summary
private void processCStruct(final CStruct struct, final Element element, final String packageName, final String user_dir)
com.jogamp.gluegen.structgen back to summary

public Class CStructAnnotationProcessor.AnnotationProcessorJavaStructEmitter

extends JavaEmitter
Class Inheritance

Field Summary

Inherited from com.jogamp.gluegen.JavaEmitter:
cfgLOG

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected PrintWriter
openFile(final String
the class's full filename to open w/ write access
filename
,
final String
the simple class name, i.e. w/o package name
simpleClassName
)

Overrides com.jogamp.gluegen.JavaEmitter.openFile.

Inherited from com.jogamp.gluegen.JavaEmitter:
addStrings2BufferbeginDefinesbeginEmissionbeginFunctionsbeginStructLayoutbeginStructscFileNamecreateConfigcWriteremitAllFileFootersemitAllFileHeadersemitCHeaderemitCInitCodeemitCustomJavaCodeemitDefineemitFunctionsemitJavaInitCodeemitStructendDefinesendEmissionendFunctionsendStructLayoutendStructsexpandMethodBindinggenerateMethodBindingEmittersgeneratePrivateEmittersgeneratePublicEmittersgetClassAccessModifiersgetConfiggetConfigurationgetImplPackageNamegetJavaOutputDirgetJavaPackageNamegetJNIMethodNamePrefixjavaFileNamejavaImplWriterjavaWriterjniManglelayoutStructmangleBindingprepCEmitterreadConfigurationFilerequiresStaticInitialization

Constructor Detail

AnnotationProcessorJavaStructEmitterback to summary
public AnnotationProcessorJavaStructEmitter()

Method Detail

openFileback to summary
protected PrintWriter openFile(final String filename, final String simpleClassName) throws IOException

Overrides com.jogamp.gluegen.JavaEmitter.openFile.

Parameters
filename:String

Doc from com.jogamp.gluegen.JavaEmitter.openFile.

the class's full filename to open w/ write access

simpleClassName:String

Doc from com.jogamp.gluegen.JavaEmitter.openFile.

the simple class name, i.e. w/o package name

Returns:PrintWriter

Doc from com.jogamp.gluegen.JavaEmitter.openFile.

a PrintWriter instance to write the class source file or null to suppress output!

Annotations
@Override