Package nz.org.riskscape.engine.bind
Interface ParameterProperty
public interface ParameterProperty
Represents an expected property or 'trait' that the parameter should have,
especially in terms of how a UI user should specify the parameter value. The
user can define these properties in a ParameterTemplate, which then gets
applied to an actual Parameter.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ParameterProperty>
List<T>filter(Collection<ParameterProperty> properties, Class<T> clazz) The presence of one property can imply other properties, e.g.default Optional<?>default booleandefault booleanimplies(ParameterProperty other) booleanisCompatible(ParameterProperty other) validate(BindingContext context, Object bound) Optionally validates that the bound value for the parameter conforms to this property, e.g.default ParameterPropertydefault ResultOrProblems<ParameterProperty>withValue(BindingContext context, Object value) Clones this ParameterProperty with the value part of a key-value pair.
-
Method Details
-
filter
static <T extends ParameterProperty> List<T> filter(Collection<ParameterProperty> properties, Class<T> clazz) - Returns:
- the subset of properties that match the given class
-
getKeyword
String getKeyword()- Returns:
- the keyword used in the project.ini to define this property
-
getImplied
List<ParameterProperty> getImplied()The presence of one property can imply other properties, e.g. the 'min' property implies that the parameter must be 'numeric'.
- Returns:
- any other properties that this particular property implies
-
implies
- Returns:
- true if this property implied that the other given property is also true
-
hasKeyValuePair
default boolean hasKeyValuePair()- Returns:
- true if this property is defined using a key-value pair, e.g.
min: 0, false if just a single keyword, e.g.numeric.
-
withValue
Clones this ParameterProperty with the value part of a key-value pair. Only supported if
hasKeyValuePair()is true. -
withValue
-
getValueOr
- Returns:
- the type of value associated with this property, if any. E.g. for a key value
pair property, like
min: 0, it'd return zero (wrapped in an Optional)
-
isCompatible
- Returns:
- true if another property is compatible with this one or not, e.g. 'min' and 'numeric' are compatible, but 'min' and 'bookmark' are not.
-
validate
Optionally validates that the bound value for the parameter conforms to this property, e.g. for a
min: 0property it would return an error if -1 were entered
-