Search in sources :

Example 1 with DeprecatedProperty

use of org.jgroups.annotations.DeprecatedProperty in project JGroups by belaban.

the class Configurator method removeDeprecatedProperties.

public static void removeDeprecatedProperties(Object obj, Map<String, String> props) throws Exception {
    // traverse class hierarchy and find all deprecated properties
    for (Class<?> clazz = obj.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
        if (clazz.isAnnotationPresent(DeprecatedProperty.class)) {
            DeprecatedProperty declaredAnnotation = clazz.getAnnotation(DeprecatedProperty.class);
            String[] deprecatedProperties = declaredAnnotation.names();
            for (String propertyName : deprecatedProperties) {
                String propertyValue = props.get(propertyName);
                if (propertyValue != null) {
                    if (log.isWarnEnabled()) {
                        String name = obj instanceof Protocol ? ((Protocol) obj).getName() : obj.getClass().getName();
                        log.warn(Util.getMessage("Deprecated"), name + "." + propertyName, "will be ignored");
                    }
                    props.remove(propertyName);
                }
            }
        }
    }
}
Also used : DeprecatedProperty(org.jgroups.annotations.DeprecatedProperty)

Aggregations

DeprecatedProperty (org.jgroups.annotations.DeprecatedProperty)1