public interface VariableContext extends VariableResolver
VariableResolver
. It extends the resolver by allowing registration of
delegate resolvers and adding a convenience method to return converted
variable values.Modifier and Type | Method and Description |
---|---|
void |
addVariableResolver(VariableResolver resolver)
Adds a variable resolver to this variable context.
|
<V> V |
getValue(String name,
ValueConverter<V> converter)
Returns the value of the variable given by name and converts it into the
target type
<V> using the given converter. |
void |
removeVariableResolver(VariableResolver resolver)
Removes the specified variable resolver if it exists and does nothing
otherwise.
|
getValue
void addVariableResolver(VariableResolver resolver)
resolver
- the resolver to addvoid removeVariableResolver(VariableResolver resolver)
resolver
- the resolver to remove<V> V getValue(String name, ValueConverter<V> converter) throws IllegalArgumentException
<V>
using the given converter. Returns null if no
such variable exists. An exception is thrown if the conversion fails, or
which is indicated by a null value returned by the converter for a
non-null input value.V
- the target value typename
- the variable nameconverter
- a converter suitable to convert values into the target type
<V>
IllegalArgumentException
- if the value conversion fails, that is, if the converter
returns null for the non-null input valueCopyright © 2024. All rights reserved.