io.quarkiverse.unleash.runtime.FeatureToggleProducer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-unleash Show documentation
Show all versions of quarkus-unleash Show documentation
Unleash is a feature toggle system
The newest version!
package io.quarkiverse.unleash.runtime;
import java.lang.annotation.Annotation;
import jakarta.enterprise.inject.Produces;
import jakarta.enterprise.inject.spi.InjectionPoint;
import jakarta.inject.Inject;
import io.getunleash.Unleash;
import io.quarkiverse.unleash.FeatureToggle;
public class FeatureToggleProducer {
@Inject
Unleash unleash;
@Produces
@FeatureToggle(name = "ignored")
boolean getFeatureToggle(InjectionPoint injectionPoint) {
FeatureToggle ft = null;
for (Annotation qualifier : injectionPoint.getQualifiers()) {
if (qualifier.annotationType().equals(FeatureToggle.class)) {
ft = (FeatureToggle) qualifier;
break;
}
}
return unleash.isEnabled(ft.name(), ft.defaultValue());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy