private Integer getValidatorSeverityFromServiceProperties()

in src/main/java/org/apache/sling/validation/impl/ValidatorMap.java [141:155]


    private Integer getValidatorSeverityFromServiceProperties(Map<String, Object> properties, Validator<?> validator,
            ServiceReference<Validator<?>> serviceReference) {
        Object severity = properties.get(Validator.PROPERTY_VALIDATOR_SEVERITY);
        if (severity == null) {
            LOG.debug("Validator '{}' is not setting an explicit severity via the OSGi service property {}", validator.getClass().getName(), Validator.PROPERTY_VALIDATOR_SEVERITY);
            return null;
        }
        if (!(severity instanceof Integer)) {
            throw new IllegalArgumentException("Validator '" + validator.getClass().getName() + "' provided from bundle "
                    + serviceReference.getBundle().getBundleId() +
                    " is providing the optional service property " + Validator.PROPERTY_VALIDATOR_SEVERITY + " with the wrong type "
                    + severity.getClass() + " (must be of type Integer)");
        }
        return (Integer) severity;
    }