
org.openl.spring.config.EnableCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.openl.spring Show documentation
Show all versions of org.openl.spring Show documentation
Common components for Spring integration
The newest version!
package org.openl.spring.config;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.MultiValueMap;
import org.openl.util.StringUtils;
class EnableCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
MultiValueMap attrs = metadata.getAllAnnotationAttributes(ConditionalOnEnable.class.getName());
if (attrs != null) {
for (Object value : attrs.get("value")) {
String[] properties = (String[]) value;
for (String property : properties) {
String propValue = context.getEnvironment().getProperty(property);
if ("false".equalsIgnoreCase(propValue) || StringUtils.isBlank(propValue)) {
return false;
}
}
}
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy