Class ParameterTemplate
Wraps a Parameter and extends it with metadata useful for modelers when building their models.
Some of the fields affect their presentation (in the CLI or the Web UI), some supply rules for transforming them before converting them in to expressions that a model can use.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA parameter can have a set of pre-defined choices, i.e. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParameterTemplate(Optional<String> label, Optional<String> description, Set<ParameterProperty> properties, List<ParameterTemplate.Choice> choices) ParameterTemplate(Optional<String> label, Optional<String> description, Set<ParameterProperty> properties, List<ParameterTemplate.Choice> choices, Optional<String> defaultValue) Creates a newParameterTemplateinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanA set of pre-defined choices for this parameter that the modeller has deemed correct.A default value.A description of this parameter, typically detailing its use in the model or the project.getLabel()A human-readable label, as an alternative to the parameter's name (which tends to follow slug conventions).Returns all properties for the parameter.<T extends ParameterProperty>
Optional<T>getProperty(T property) Returns the specified property, if present in the template.inthashCode()booleanhasProperty(ParameterProperty property) toString()validate(BindingContext context, Object bound) withDefaultValue(String newDefault) withProperties(Set<ParameterProperty> newProperties)
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ParameterTemplate
public ParameterTemplate(Optional<String> label, Optional<String> description, Set<ParameterProperty> properties, List<ParameterTemplate.Choice> choices) -
ParameterTemplate
public ParameterTemplate(Optional<String> label, Optional<String> description, Set<ParameterProperty> properties, List<ParameterTemplate.Choice> choices, Optional<String> defaultValue) Creates a new
ParameterTemplateinstance.- Parameters:
label- A human-readable label, as an alternative to the parameter's name (which tends to follow slug conventions).description- A description of this parameter, typically detailing its use in the model or the project.properties- The set of properties that customise this parameter template. These typically apply validation and transformations to the raw value before it gets converted in to an expression.choices- A set of pre-defined choices for this parameter that the modeller has deemed correct.defaultValue- A default value. NB work out how this relates to the existing default that lives on a Parameter
-
-
Method Details
-
hasProperty
-
getProperty
Returns the specified property, if present in the template. This is mainly useful for
KeyValueProperty, where the actual ParameterProperty instance has more info associated with it. -
withLabel
-
withProperties
- Returns:
- a cloned copy of this template with the newProperties specified
-
withDefaultValue
-
validate
- Returns:
- a list of problems when validating this
boundparameter. These validation rules are in addition to the type-based validation that the Parameter binding already provides.
-
getProperties
Returns all properties for the parameter. These properties may be explicitly set by the user, implied (e.g. MIN_VALUE implies NUMERIC), or inferred (e.g. if no properties are explicitly set, then we can tell from the default value
[1,2,3]that the parameter is both NUMERIC and a LIST). -
getLabel
A human-readable label, as an alternative to the parameter's name (which tends to follow slug conventions).
-
getDescription
A description of this parameter, typically detailing its use in the model or the project.
-
getChoices
A set of pre-defined choices for this parameter that the modeller has deemed correct.
-
getDefaultValue
A default value. NB work out how this relates to the existing default that lives on a Parameter
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-