/** * Just like {@link #hasParameter(ConfigProperty)}, check if parameter with given key is present, but returns * <code>true</code> only if parameter has a not <code>null</code> value. * @param <T> Parameter value type * @param property ConfigProperty to check (not null) * @return <code>true</code> if parameter is present and its value is not null, <code>false</code> otherwise */ default <T> boolean hasNotNullParameter(ConfigProperty<T> property) { ObjectUtils.argumentNotNull(property, "ConfigProperty must be not null"); return hasNotNullParameter(property.getKey()); }
public void parameterSet() { // tag::params[] final ConfigProperty<String> property = ConfigProperty.create("test", String.class); ParameterSet set = ParameterSet.builder().withParameter("testParameter", 1L) // <1> .withParameter(property, "testValue") // <2> .build(); boolean present = set.hasParameter("testParameter"); // <3> present = set.hasNotNullParameter("testParameter"); // <4> Optional<String> value = set.getParameter("testParameter", String.class); // <5> String val = set.getParameter("testParameter", String.class, "default"); // <6> Optional<String> configPropertyValue = set.getParameter(property); // <7> String configPropertyVal = set.getParameter(property, "default"); // <8> boolean matches = set.hasParameterValue("testParameter", "myValue"); // <9> matches = set.hasParameterValue(property, "myValue"); // <10> // end::params[] }