Interface Feature
- All Superinterfaces:
io.micronaut.core.naming.Described,io.micronaut.core.naming.Named,io.micronaut.core.order.Ordered
- All Known Subinterfaces:
ApplicationFeature,BuildFeature,BuildPluginFeature,ConfigurationFeature,DefaultFeature,DistributedConfigFeature,GradleSpecificFeature,GroovyApplicationFeature,JavaApplicationFeature,JsonFeature,KotlinApplicationFeature,KotlinSpecificFeature,KotlinSymbolProcessingFeature,LanguageFeature,LanguageSpecificFeature,LicenseFeature,LoggingFeature,MavenSpecificFeature,MultiProjectFeature,OneOfFeature,OpenRewriteFeature,ParentPomFeature,RequiresRepository,TestFeature
- All Known Implementing Classes:
Apache2LicenseFeature,Config4k,GitIgnore,Gradle,Maven,MavenPublishGradlePlugin,Properties,SigningGradlePlugin,SpotlessGradlePlugin,Toml,Yaml
@Indexed(Feature.class)
public interface Feature
extends io.micronaut.core.naming.Named, io.micronaut.core.order.Ordered, io.micronaut.core.naming.Described
A feature is a class that affects the outcome of a generated
project.
- Since:
- 2.0.0
- Author:
- James Kleeh
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptiondefault voidapply(GeneratorContext generatorContext) If this method is called for a given feature that means the feature was explicitly selected, included by default as a result ofDefaultFeature.shouldApply(io.micronaut.starter.options.Options, java.util.Set), or added explicitly by another feature throughFeatureContext.addFeature(Feature).default @Nullable Stringdefault Stringdefault @Nullable StringgetFrameworkDocumentation(GeneratorContext generatorContext) @NonNull StringgetName()The name of the feature.default intgetOrder()The order of a feature controls the order in which it applies.default @Nullable StringgetThirdPartyDocumentation(GeneratorContext generatorContext) default StringgetTitle()default booleandefault booleandefault booleanSome 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 voidprocessSelectedFeatures(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 ofDefaultFeature.shouldApply(io.micronaut.starter.options.Options, java.util.Set).default booleanThis method must be implemented to ensure it is only selectable for the desired application types.Methods inherited from interface io.micronaut.core.naming.Described
getDescription
-
Method Details
-
getName
The name of the feature. It must be unique.- Specified by:
getNamein interfaceio.micronaut.core.naming.Named- Returns:
- the name of the feature
-
isPreview
default boolean isPreview()- Returns:
- Indicates the feature is in preview status and is subject to change.
-
isCommunity
default boolean isCommunity()- Returns:
- Indicates the feature is a community contribution.
-
getTitle
- Returns:
- The title of the feature
-
getDescription
- Specified by:
getDescriptionin interfaceio.micronaut.core.naming.Described
-
getOrder
default int getOrder()The order of a feature controls the order in which it applies. The order of a feature is important to ensure that any previous work done by other features that may be required is done. SeeFeaturePhasefor a list of phases to choose from.- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered- Returns:
- The order of the feature
-
processSelectedFeatures
If this method is called for a given feature then that feature was explicitly selected or was included by default as a result ofDefaultFeature.shouldApply(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 methodsFeatureContext.addFeature(Feature)andFeatureContext.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.- Parameters:
featureContext- The feature context
-
apply
If this method is called for a given feature that means the feature was explicitly selected, included by default as a result ofDefaultFeature.shouldApply(io.micronaut.starter.options.Options, java.util.Set), or added explicitly by another feature throughFeatureContext.addFeature(Feature). At this point the feature list is set and cannot change.- Parameters:
generatorContext- THe generator context
-
supports
This method must be implemented to ensure it is only selectable for the desired application types. This method is not used for determining if a default feature should be applied.- Parameters:
options- Options- Returns:
- True if the feature can be selected by the user
-
isVisible
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.- Returns:
- True if the feature should be able to be selected by the user
-
getCategory
- Returns:
- The Category to which the feature belongs to.
-
getFrameworkDocumentation
- Parameters:
generatorContext- Generator Context- Returns:
- Returns a link to Framework documentation about the feature. eg. https://micronaut-projects.github.io/micronaut-cache/latest/guide/index.html#hazelcast
-
getThirdPartyDocumentation
- Parameters:
generatorContext- Generator Context- Returns:
- Returns a link to third party. E.g. https://hazelcast.org
-