@SupportedAnnotationTypes(value="org.corfudb.annotations.*") public class ObjectAnnotationProcessor extends AbstractProcessor
The annotation processor, which takes annotated Corfu objects and generates a class which can be used by the runtime instead of requiring runtime instrumentation.
See README.md for details on how the annotation processor works and how to use it.
Created by mwei on 11/9/16.
processingEnv
Constructor and Description |
---|
ObjectAnnotationProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
addConflictFieldFromFunctionToMethod(com.squareup.javapoet.MethodSpec.Builder ms,
String conflictField,
String functionName,
ExecutableElement smrMethod)
Add a conflict field to the method.
|
void |
addConflictFieldToMethod(com.squareup.javapoet.MethodSpec.Builder ms,
String conflictField,
ExecutableElement smrMethod)
Add a conflict field to the method.
|
void |
generateProxy(TypeElement classElement)
Generate a proxy file.
|
String |
getSmrFunctionName(ExecutableElement smrMethod)
Return a SMR function name, extracting it from the annotations if available.
|
SourceVersion |
getSupportedSourceVersion()
Always support the latest source version.
|
void |
init(ProcessingEnvironment processingEnv) |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
void |
processClass(TypeElement classElement)
Process each class, checking if the class is annotated and
generating the appropriate proxy class.
|
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
public SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion
in interface Processor
getSupportedSourceVersion
in class AbstractProcessor
public void init(ProcessingEnvironment processingEnv)
init
in interface Processor
init
in class AbstractProcessor
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process
in interface Processor
process
in class AbstractProcessor
public void processClass(TypeElement classElement)
classElement
- The element to process.public String getSmrFunctionName(ExecutableElement smrMethod)
smrMethod
- The ExecutableElement to extract the name from.public void generateProxy(TypeElement classElement) throws IOException
classElement
- The element to generate a proxy file forIOException
- If we could not generate the proxy filepublic void addConflictFieldToMethod(com.squareup.javapoet.MethodSpec.Builder ms, String conflictField, ExecutableElement smrMethod)
ms
- The builder to add the field to.conflictField
- The name of the field to addsmrMethod
- The method element.public void addConflictFieldFromFunctionToMethod(com.squareup.javapoet.MethodSpec.Builder ms, String conflictField, String functionName, ExecutableElement smrMethod)
ms
- The builder to add the field to.conflictField
- The name of the field to addfunctionName
- The function to call to obtain the parameters.smrMethod
- The method element.Copyright © 2019 CorfuDB. All rights reserved.