Package ftbsc.lll.processor.utils
Class JavaPoetUtils
- java.lang.Object
-
- ftbsc.lll.processor.utils.JavaPoetUtils
-
public class JavaPoetUtils extends java.lang.Object
Collection of static utils that rely on JavaPoet to function.
-
-
Constructor Summary
Constructors Constructor Description JavaPoetUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 givenMethodSpec.Builder
definitions for a proxy.static MethodSpec
buildStringReturnMethod(java.lang.String name, java.lang.String returnString)
Builds aMethodSpec
for a public method whose body simply returns aString
.static java.util.HashSet<MethodSpec>
generateDummies(javax.lang.model.element.TypeElement clazz)
Generates aHashSet
of dummy overrides for every abstract method in a given class, represented as aTypeElement
.static MethodSpec
generateInjector(InjectorInfo inj, javax.annotation.processing.ProcessingEnvironment env)
Generates the wrapper around a certain injector.
-
-
-
Method Detail
-
buildStringReturnMethod
public static MethodSpec buildStringReturnMethod(java.lang.String name, java.lang.String returnString)
Builds aMethodSpec
for a public method whose body simply returns aString
.- Parameters:
name
- the name of the methodreturnString
- theString
to return- Returns:
- the built
MethodSpec
-
appendMemberFinderDefinition
public 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 givenMethodSpec.Builder
definitions for a proxy.- Parameters:
var
- theVariableElement
representing the proxystub
- the stubExecutableElement
if present or relevant, null otherwiset
- theTarget
relevant to this finder if present or relevant, null otherwisecon
- theMethodSpec.Builder
to append tooptions
- theProcessorOptions
to be used- Since:
- 0.5.0
-
generateDummies
public static java.util.HashSet<MethodSpec> generateDummies(javax.lang.model.element.TypeElement clazz)
Generates aHashSet
of dummy overrides for every abstract method in a given class, represented as aTypeElement
.- Parameters:
clazz
- the given class- Returns:
- a
HashSet
containing the generatedMethodSpec
s - Since:
- 0.5.0
-
generateInjector
public static MethodSpec generateInjector(InjectorInfo inj, javax.annotation.processing.ProcessingEnvironment env)
Generates the wrapper around a certain injector.- Parameters:
inj
- theInjectorInfo
carrying the information about the target injectorenv
- theProcessingEnvironment
to perform the operation in- Returns:
- the generated
MethodSpec
for the injector - Since:
- 0.6.0
-
-