@Singleton public class Kotlin extends java.lang.Object implements LanguageFeature
Modifier and Type | Field and Description |
---|---|
protected java.util.List<KotlinApplicationFeature> |
applicationFeatures |
protected static Dependency |
DEPENDENCY_MICRONAUT_KOTLIN_RUNTIME |
Constructor and Description |
---|
Kotlin(java.util.List<KotlinApplicationFeature> applicationFeatures) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDependencies(GeneratorContext generatorContext) |
protected void |
addKotlinVersionProperty(GeneratorContext generatorContext) |
void |
apply(GeneratorContext generatorContext)
If this method is called for a given feature that means the feature was explicitly selected,
included by default as a result of
DefaultFeature.shouldApply(ApplicationType, io.micronaut.starter.options.Options, java.util.Set) ,
or added explicitly by another feature through FeatureContext.addFeature(Feature) . |
java.lang.String |
getName()
The name of the feature.
|
boolean |
isKotlin() |
void |
processSelectedFeatures(FeatureContext featureContext)
If this method is called for a given feature then that feature was explicitly selected
or was included by default as a result of
DefaultFeature.shouldApply(ApplicationType, io.micronaut.starter.options.Options, java.util.Set) . |
protected void |
processSelectedFeatures(FeatureContext featureContext,
java.util.function.Predicate<Feature> filter) |
boolean |
shouldApply(ApplicationType applicationType,
Options options,
java.util.Set<Feature> selectedFeatures)
Determines if the feature should be applied to the project.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOrder, isGroovy, isJava, isVisible, supports
getCategory, getDescription, getMicronautDocumentation, getThirdPartyDocumentation, getTitle, isCommunity, isPreview
protected static final Dependency DEPENDENCY_MICRONAUT_KOTLIN_RUNTIME
protected final java.util.List<KotlinApplicationFeature> applicationFeatures
public Kotlin(java.util.List<KotlinApplicationFeature> applicationFeatures)
@NonNull public java.lang.String getName()
Feature
public void processSelectedFeatures(FeatureContext featureContext)
Feature
DefaultFeature.shouldApply(ApplicationType, io.micronaut.starter.options.Options, java.util.Set)
.
This method can be implemented to allow features to modify the list of features
that will apply to the project. The methods FeatureContext.addFeature(Feature)
and FeatureContext.exclude(FeaturePredicate)
are the primary ways to add and
remove features from the context. FeatureContext.isPresent(Class)
can be used
to determine the existence of other features in order to make decisions.processSelectedFeatures
in interface Feature
featureContext
- The feature contextprotected void processSelectedFeatures(FeatureContext featureContext, java.util.function.Predicate<Feature> filter)
public void apply(GeneratorContext generatorContext)
Feature
DefaultFeature.shouldApply(ApplicationType, io.micronaut.starter.options.Options, java.util.Set)
,
or added explicitly by another feature through FeatureContext.addFeature(Feature)
.
At this point the feature list is set and cannot change.
This method can be implemented to modify the generated project. The feature can add templates
by executing GeneratorContext.addTemplate(String, io.micronaut.starter.template.Template)
, modify configuration
by modifying GeneratorContext.getConfiguration()
or GeneratorContext.getBootstrapConfiguration()
, or modify build properties through GeneratorContext.getBuildProperties()
.protected void addKotlinVersionProperty(GeneratorContext generatorContext)
protected void addDependencies(GeneratorContext generatorContext)
public boolean isKotlin()
isKotlin
in interface LanguageFeature
public boolean shouldApply(ApplicationType applicationType, Options options, java.util.Set<Feature> selectedFeatures)
DefaultFeature
shouldApply
in interface DefaultFeature
applicationType
- The application typeoptions
- The optionsselectedFeatures
- The features manually selected by the user