io.quarkus.arc.runtime.SuppressConditions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-arc Show documentation
Show all versions of quarkus-arc Show documentation
Build time CDI dependency injection
package io.quarkus.arc.runtime;
import java.util.Optional;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
public final class SuppressConditions {
private SuppressConditions() {
}
public static boolean suppressIfProperty(String propertyName, String stringValue, boolean lookupIfMissing) {
Config config = ConfigProviderResolver.instance().getConfig();
Optional optionalValue = config.getOptionalValue(propertyName, String.class);
if (optionalValue.isPresent()) {
return !stringValue.equals(optionalValue.get());
} else {
return !lookupIfMissing;
}
}
public static boolean suppressUnlessProperty(String propertyName, String stringValue, boolean lookupIfMissing) {
Config config = ConfigProviderResolver.instance().getConfig();
Optional optionalValue = config.getOptionalValue(propertyName, String.class);
if (optionalValue.isPresent()) {
return stringValue.equals(optionalValue.get());
} else {
return !lookupIfMissing;
}
}
}