Class PluginUtils
java.lang.Object
io.micronaut.sourcegen.generator.visitors.PluginUtils
Common utility methods for plugin generation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordConfiguration for a plugin parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.micronaut.sourcegen.model.ExpressionDefcreateDefault(io.micronaut.sourcegen.model.TypeDef type, String value) A utility method for getting the default value.static io.micronaut.sourcegen.model.StatementDefexecuteTaskMethod(io.micronaut.inject.ast.ClassElement source, String methodName, Map<String, io.micronaut.sourcegen.model.ExpressionDef> arguments) A common method for executing the main task executable.static io.micronaut.inject.ast.MethodElementgetTaskExecutable(io.micronaut.inject.ast.ClassElement source) Validate and get the method name of the task executable.static io.micronaut.sourcegen.model.VariableDef.LocalinstantiateType(io.micronaut.inject.ast.ClassElement element, String name, Map<String, io.micronaut.sourcegen.model.ExpressionDef> arguments, List<io.micronaut.sourcegen.model.StatementDef> statements) Instantiate a type.
-
Constructor Details
-
PluginUtils
public PluginUtils()
-
-
Method Details
-
getTaskExecutable
public static io.micronaut.inject.ast.MethodElement getTaskExecutable(io.micronaut.inject.ast.ClassElement source) Validate and get the method name of the task executable.- Parameters:
source- The source element annotated withPluginTask.- Returns:
- The method name
-
instantiateType
public static io.micronaut.sourcegen.model.VariableDef.Local instantiateType(io.micronaut.inject.ast.ClassElement element, String name, Map<String, io.micronaut.sourcegen.model.ExpressionDef> arguments, List<io.micronaut.sourcegen.model.StatementDef> statements) Instantiate a type.- Parameters:
element- The class elementname- The name to use for the local variablearguments- The arguments provided for type creation corresponding to propertiesstatements- A mutable statements list- Returns:
- The local variable representing the instantiated type
-
executeTaskMethod
public static io.micronaut.sourcegen.model.StatementDef executeTaskMethod(io.micronaut.inject.ast.ClassElement source, String methodName, Map<String, io.micronaut.sourcegen.model.ExpressionDef> arguments) A common method for executing the main task executable.- Parameters:
source- The source annotated withPluginTaskmethodName- The name of the method annotated withPluginTaskExecutablearguments- The prepared arguments for the task by name- Returns:
- The statements to execute the task method
-
createDefault
public static io.micronaut.sourcegen.model.ExpressionDef createDefault(io.micronaut.sourcegen.model.TypeDef type, String value) A utility method for getting the default value.- Parameters:
type- The required typevalue- The default value as string- Returns:
- The default expression
-