public class JavaPoetUtils
extends java.lang.Object
| Constructor and Description |
|---|
JavaPoetUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendMemberFinderDefinition(javax.lang.model.element.VariableElement var,
javax.lang.model.element.ExecutableElement stub,
Target t,
MethodSpec.Builder con,
ProcessorOptions options)
Appends to a given
MethodSpec.Builder definitions for a proxy. |
static MethodSpec |
buildStringReturnMethod(java.lang.String name,
java.lang.String returnString)
Builds a
MethodSpec for a public method whose body simply returns a String. |
static java.util.HashSet<MethodSpec> |
generateDummies(javax.lang.model.element.TypeElement clazz)
Generates a
HashSet of dummy overrides for every abstract method in a given class,
represented as a TypeElement. |
static MethodSpec |
generateInjector(InjectorInfo inj,
javax.annotation.processing.ProcessingEnvironment env)
Generates the wrapper around a certain injector.
|
static java.lang.String |
generateRealClassName(javax.lang.model.element.TypeElement cl)
Generates the "real" class name for a
TypeElement. |
static java.lang.String |
writeClass(javax.annotation.processing.Filer filer,
java.lang.String pkg,
java.lang.String name,
TypeSpec spec)
Writes a Java source file from a JavaPoet spec.
|
public static MethodSpec buildStringReturnMethod(java.lang.String name, java.lang.String returnString)
MethodSpec for a public method whose body simply returns a String.name - the name of the methodreturnString - the String to returnMethodSpecpublic static void appendMemberFinderDefinition(javax.lang.model.element.VariableElement var,
javax.lang.model.element.ExecutableElement stub,
Target t,
MethodSpec.Builder con,
ProcessorOptions options)
MethodSpec.Builder definitions for a proxy.var - the VariableElement representing the proxystub - the stub ExecutableElement if present or relevant, null otherwiset - the Target relevant to this finder if present or relevant, null otherwisecon - the MethodSpec.Builder to append tooptions - the ProcessorOptions to be usedpublic static java.util.HashSet<MethodSpec> generateDummies(javax.lang.model.element.TypeElement clazz)
HashSet of dummy overrides for every abstract method in a given class,
represented as a TypeElement.clazz - the given classHashSet containing the generated MethodSpecspublic static MethodSpec generateInjector(InjectorInfo inj, javax.annotation.processing.ProcessingEnvironment env)
inj - the InjectorInfo carrying the information about the target injectorenv - the ProcessingEnvironment to perform the operation inMethodSpec for the injectorpublic static java.lang.String generateRealClassName(javax.lang.model.element.TypeElement cl)
TypeElement. The "real" class name
is identical to the simple name for normal classes, and is the result of recursively
joining the simple name with the parent's with "$" for inner classes.cl - the class to generate it forpublic static java.lang.String writeClass(javax.annotation.processing.Filer filer,
java.lang.String pkg,
java.lang.String name,
TypeSpec spec)
filer - the processing environment's Filerpkg - the package to output this toname - the simple name of the classspec - the TypeSpec for it