Search in sources :

Example 1 with FeaturePredicate

use of io.micronaut.starter.feature.FeaturePredicate in project micronaut-starter by micronaut-projects.

the class Springloaded method processSelectedFeatures.

@Override
public void processSelectedFeatures(FeatureContext featureContext) {
    int jdkVersion = featureContext.getJavaVersion().majorVersion();
    if (jdkVersion >= 9) {
        Springloaded springloaded = this;
        featureContext.exclude(new FeaturePredicate() {

            @Override
            public boolean test(Feature feature) {
                return feature == springloaded;
            }

            @Override
            public Optional<String> getWarning() {
                return Optional.of("Springloaded was excluded because it does not support JDK " + jdkVersion);
            }
        });
    }
}
Also used : Optional(java.util.Optional) FeaturePredicate(io.micronaut.starter.feature.FeaturePredicate) Feature(io.micronaut.starter.feature.Feature)

Aggregations

Feature (io.micronaut.starter.feature.Feature)1 FeaturePredicate (io.micronaut.starter.feature.FeaturePredicate)1 Optional (java.util.Optional)1