Class BoundParameters
A set of parameter values that have been bound from a particular ParameterSet
. While all values should be
valid, it's possible that the values are incomplete or there are missing or extra values - the
ParameterSet.bind(BindingContext, Map)
returns a ResultOrProblems
object that will indicate whether
the parameters are valid or not
-
Constructor Summary
ConstructorDescriptionBoundParameters
(ParameterSet boundTo, BindingContext context, Map<String, List<?>> valueMap, Map<String, List<?>> unbound, List<Problem> validationProblems) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
<T> ResultOrProblems<T>
flatMap
(Function<BoundParameters, ResultOrProblems<T>> function) ResultOrProblems
like method for mapping the parameters in to another ResultOrProblems object, but only if the parameters are validTheParameterSet
that the unbound values were bound toTheBindingContext
under which the parameters were boundThe original, given values that were bound.The bound, valid, values that correspond to theboundTo
parameter set.List<?>
int
hashCode()
boolean
isValid()
<T> ResultOrProblems<T>
map
(Function<BoundParameters, T> function) ResultOrProblems
like method for mapping the parameters in to another object, but only if the parameters are validmerge
(BoundParameters other) Merge these bound parameters with other such that any parameter that is set in other will replace one that this set in these bound parameters.toString()
withMoreProblems
(List<Problem> moreProblems) Lets the calling code include more bespoke validation problems besides the straight-forward binding errors.
-
Constructor Details
-
BoundParameters
public BoundParameters(ParameterSet boundTo, BindingContext context, Map<String, List<?>> valueMap, Map<String, List<?>> unbound, List<Problem> validationProblems)
-
-
Method Details
-
getValue
- Returns:
- the value bound to the parameter with the given name, or null if not set
- Throws:
IllegalArgumentException
- if the parameter has a max arity of greater than one
-
getValues
- Returns:
- the values bound to the parameter with the given name
-
getExtraneous
- Returns:
- a map of parameters that were given but not used during binding (because they didn't correspond to a parameter in the parameter set). Note that extra parameters do not create a warning or an error.
-
isValid
public boolean isValid() -
map
ResultOrProblems
like method for mapping the parameters in to another object, but only if the parameters are valid -
flatMap
ResultOrProblems
like method for mapping the parameters in to another ResultOrProblems object, but only if the parameters are valid -
toString
-
merge
Merge these bound parameters with other such that any parameter that is set in other will replace one that this set in these bound parameters.
- Parameters:
other
- bound parameters that will set/replace values set in these bound parameters- Returns:
- new bound parameters with updated parameter values
- Throws:
IllegalArgumentException
- if this and other have a different context or boundTo
-
withMoreProblems
Lets the calling code include more bespoke validation problems besides the straight-forward binding errors.
- Returns:
- a new BoundParameters with the additional problems included.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getBoundTo
The
ParameterSet
that the unbound values were bound to -
getContext
The
BindingContext
under which the parameters were bound -
getValueMap
The bound, valid, values that correspond to the
boundTo
parameter set. -
getUnbound
The original, given values that were bound. May not be present, depending on how the parameters were created. May also contain values that were not bound, because they were invalid or surplus.
-
getValidationProblems
- Returns:
- any
Problem
s encountered during binding - the presence of error-level problems indicates a failed result
-