Interface KotlinCodeGenerationSpi
-
- All Implemented Interfaces:
-
java.util.function.BiPredicate
,kotlin.Comparable
public interface KotlinCodeGenerationSpi<CONTEXT extends KotlinCodeGenerationContext<CONTEXT>, INPUT extends Object> implements Comparable<KotlinCodeGenerationSpi<?, ?>>, BiPredicate<CONTEXT, Any>
Root interface for code generation spi.
This is a sealed interface, the only allowed subtypes are:
KotlinCodeGenerationStrategy - the build plan of a spec using input and context
KotlinCodeGenerationProcessor - visitor pattern to modify spec builders before the spec is build.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
KotlinCodeGenerationSpi.Companion
-
Method Summary
Modifier and Type Method Description Integer
compareTo(KotlinCodeGenerationSpi<?, ?> other)
Compare by order to sort list of SPI instances. Boolean
test(CONTEXT context, Object input)
If true
, the spi instance is executed, else ignored.abstract String
getName()
The name that is used when the implementing class is listed in a META-INF/services/
file.abstract KClass<out INPUT>
getInputType()
The type of the generic INPUT, used to filter relevant instances. abstract KClass<out CONTEXT>
getContextType()
The type of the generic CONTEXT, used to filter relevant instances. abstract Integer
getOrder()
Order is used to sort spi instances. -
-
Method Detail
-
compareTo
Integer compareTo(KotlinCodeGenerationSpi<?, ?> other)
Compare by order to sort list of SPI instances.
- Parameters:
other
- the other spi instance- Returns:
-1,0,1 as specified by Comparable
-
test
Boolean test(CONTEXT context, Object input)
If
true
, the spi instance is executed, else ignored.- Parameters:
context
- the context we are operating ininput
- the concrete work item, for the check this is unbound and nullable, so we can check against calling with unsupported types.- Returns:
true
when the spi shoud be applied.
-
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$
.
-
getInputType
abstract KClass<out INPUT> getInputType()
The type of the generic INPUT, used to filter relevant instances.
-
getContextType
abstract KClass<out CONTEXT> getContextType()
The type of the generic CONTEXT, used to filter relevant instances.
-
-
-
-