public class JavaPoetUtils
extends java.lang.Object
| Constructor and Description |
|---|
JavaPoetUtils() |
| Modifier and Type | Method and Description |
|---|---|
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 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 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 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