@SupportedSourceVersion(value=RELEASE_8) public class ByteCodeFactoryGenerator extends AbstractProcessor
ByteCodeSpecprocessingEnv| Constructor and Description |
|---|
ByteCodeFactoryGenerator() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getClassName(TypeElement el)
Return the qualified name of a type (those that contain a $ sign for
nested classes).
|
static String |
getClassName(TypeMirror tm)
Return the qualified name of a type (those that contain a $ sign for
nested classes).
|
String |
getCode()
The code generator is based on the output given by the disassembler :
$ javap -c -v ml.alternet.util.gen.sample.SampleInterfaceImpl
Output :
Compiled from "SampleInterfaceImpl.java"
public class ml.alternet.util.gen.sample.SampleInterfaceImpl implements ml.alternet.util.gen.sample.SampleInterface {
public static final ml.alternet.util.gen.sample.SampleInterface SAMPLE_INTERFACE;
static {};
Code:
0: new #1 // class ml/alternet/util/gen/sample/SampleInterfaceImpl
3: dup
4: invokespecial #12 // Method "<init>":()V
7: putstatic #15 // Field SAMPLE_INTERFACE:Lml/alternet/util/gen/sample/SampleInterface;
10: return
public ml.alternet.util.gen.sample.SampleInterfaceImpl();
Code:
0: aload_0
1: invokespecial #19 // Method java/lang/Object."
|
Set<String> |
getSupportedAnnotationTypes() |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
void |
processAnnotation(Element element,
ByteCodeSpec byteCode) |
void |
processAnnotations(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
getCompletions, getSupportedOptions, getSupportedSourceVersion, init, isInitializedpublic Set<String> getSupportedAnnotationTypes()
getSupportedAnnotationTypes in interface ProcessorgetSupportedAnnotationTypes in class AbstractProcessorpublic boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process in interface Processorprocess in class AbstractProcessorpublic void processAnnotations(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
public void processAnnotation(Element element, ByteCodeSpec byteCode)
public static String getClassName(TypeMirror tm)
tm - Represent the classpublic static String getClassName(TypeElement el)
el - Represent the classpublic String getCode()
$ javap -c -v ml.alternet.util.gen.sample.SampleInterfaceImplOutput :
Compiled from "SampleInterfaceImpl.java"
public class ml.alternet.util.gen.sample.SampleInterfaceImpl implements ml.alternet.util.gen.sample.SampleInterface {
public static final ml.alternet.util.gen.sample.SampleInterface SAMPLE_INTERFACE;
static {};
Code:
0: new #1 // class ml/alternet/util/gen/sample/SampleInterfaceImpl
3: dup
4: invokespecial #12 // Method "<init>":()V
7: putstatic #15 // Field SAMPLE_INTERFACE:Lml/alternet/util/gen/sample/SampleInterface;
10: return
public ml.alternet.util.gen.sample.SampleInterfaceImpl();
Code:
0: aload_0
1: invokespecial #19 // Method java/lang/Object."<init>":()V
4: return
}Copyright © 2018 Alternet. All rights reserved.