Interface KotlinCodeGenerationProcessor
-
- All Implemented Interfaces:
-
io.toolisticon.kotlin.generation.WithTags,io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationSpi,java.util.function.BiPredicate,kotlin.Comparable
public interface KotlinCodeGenerationProcessor<CONTEXT extends KotlinCodeGenerationContext<CONTEXT>, INPUT extends Object, BUILDER extends Object> implements KotlinCodeGenerationSpi<CONTEXT, INPUT>
Root interface of all processors. Used to load all implementations via ServiceLoader/SPI.
A processor implements the visitor pattern. It takes the current context and the concrete work item to modify the passed builder.
Example: add additional annotations to a class builder.
Hint: for implementing a concrete processor, use the io.toolisticon.kotlin.generation.spi.processor.KotlinCodeGenerationProcessorBase.
-
-
Method Summary
Modifier and Type Method Description abstract BUILDERinvoke(CONTEXT context, INPUT input, BUILDER builder)Input is nullable because we could use processors solely based on context. Booleantest(CONTEXT context, Object input)Checks if this processor should be applied. BUILDERexecute(CONTEXT context, INPUT input, BUILDER builder)Checks if this strategy should be applied (using test) and then runsinvoke.abstract KClass<CONTEXT>getContextType()The type of the generic CONTEXT, used to filter relevant instances. abstract KClass<INPUT>getInputType()The type of the generic INPUT, used to filter relevant instances. abstract IntegergetOrder()Order is used to sort spi instances. abstract StringgetName()The name that is used when the implementing class is listed in a META-INF/services/file.abstract KClass<BUILDER>getBuilderType()-
Methods inherited from class io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationSpi
compareTo, tag -
Methods inherited from class java.util.function.BiPredicate
and, negate, or -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
invoke
abstract BUILDER invoke(CONTEXT context, INPUT input, BUILDER builder)
Input is nullable because we could use processors solely based on context.
-
test
Boolean test(CONTEXT context, Object input)
Checks if this processor should be applied.
- Parameters:
context- the context we are operating ininput- the concrete work item- Returns:
trueif this processor should be applied,falseotherwise.
-
execute
BUILDER execute(CONTEXT context, INPUT input, BUILDER builder)
Checks if this strategy should be applied (using
test) and then runsinvoke.- Parameters:
context- the context we are operating ininput- the concrete work item, nullable for test.builder- the builder to modify- Returns:
the passed builder instance for fluent usage
-
getContextType
abstract KClass<CONTEXT> getContextType()
The type of the generic CONTEXT, used to filter relevant instances.
-
getInputType
abstract KClass<INPUT> getInputType()
The type of the generic INPUT, used to filter relevant instances.
-
getName
abstract String getName()
The name that is used when the implementing class is listed in a
META-INF/services/file. Attention: SPI uses java naming, so inner classes have to be separated by$.
-
getBuilderType
abstract KClass<BUILDER> getBuilderType()
-
-
-
-