@Indexed(value=Feature.class) public interface Feature extends io.micronaut.core.naming.Named, io.micronaut.core.order.Ordered, io.micronaut.core.naming.Described
Modifier and Type | Method and Description |
---|---|
default 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) . |
default java.lang.String |
getCategory() |
default java.lang.String |
getDescription() |
default java.lang.String |
getMicronautDocumentation() |
java.lang.String |
getName()
The name of the feature.
|
default int |
getOrder()
The order of a feature controls the order in which it applies.
|
default java.lang.String |
getThirdPartyDocumentation() |
default java.lang.String |
getTitle() |
default boolean |
isCommunity() |
default boolean |
isPreview() |
default boolean |
isVisible()
Some features should not be visible to the user because they are a common parent of other
selectable features, or they should always be applied, or any other reason.
|
default 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) . |
boolean |
supports(ApplicationType applicationType)
This method must be implemented to ensure it is only selectable for the desired
application types.
|
@NonNull java.lang.String getName()
getName
in interface io.micronaut.core.naming.Named
default boolean isPreview()
default boolean isCommunity()
default java.lang.String getTitle()
default java.lang.String getDescription()
getDescription
in interface io.micronaut.core.naming.Described
default int getOrder()
FeaturePhase
for a list of phases to choose from.getOrder
in interface io.micronaut.core.order.Ordered
default void processSelectedFeatures(FeatureContext featureContext)
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.featureContext
- The feature contextdefault void apply(GeneratorContext generatorContext)
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()
.generatorContext
- THe generator contextboolean supports(ApplicationType applicationType)
applicationType
- The application typedefault boolean isVisible()
default java.lang.String getCategory()
Category
to which the feature belongs to.@Nullable default java.lang.String getMicronautDocumentation()
@Nullable default java.lang.String getThirdPartyDocumentation()