/** * Retrieves a parameter from the parameter provider set for this rule (or the default provider). If the parameter * is not set, an empty optional is returned. * * @param key * the key of the parameter used to identify the parameter value * @param type * the type of the parameter value * @param <T> * the type of the parameter value. The method performs an auto-conversion of primitive types, their Object * representation and Strings (no conversion). * * @return the parameter value */ public <T> Optional<T> getValue(String key, Class<T> type) { return provider.apply(key).map(value -> TypeUtils.convert(value).to(type)); }