private String getValidatorIdFromServiceProperties()

in src/main/java/org/apache/sling/validation/impl/ValidatorMap.java [124:139]


    private String getValidatorIdFromServiceProperties(Map<String, Object> properties, @SuppressWarnings("rawtypes") Class<? extends Validator> validatorClass,
            ServiceReference<Validator<?>> serviceReference) {
        Object id = properties.get(Validator.PROPERTY_VALIDATOR_ID);
        if (id == null) {
            throw new IllegalArgumentException("Validator '" + validatorClass.getName() + "' provided from bundle "
                    + serviceReference.getBundle().getBundleId() +
                    " is lacking the mandatory service property " + Validator.PROPERTY_VALIDATOR_ID);
        }
        if (!(id instanceof String)) {
            throw new IllegalArgumentException("Validator '" + validatorClass.getName() + "' provided from bundle "
                    + serviceReference.getBundle().getBundleId() +
                    " is providing the mandatory service property " + Validator.PROPERTY_VALIDATOR_ID + " with the wrong type "
                    + id.getClass() + " (must be of type String)");
        }
        return (String) id;
    }