|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weborganic.furi.VariableResolverList
public class VariableResolverList
A variable resolver using a list to resolve values. For example, to constrain a variable value to a specific list:
// Create a new variable resolver on a list of values VariableResolver vr = new VariableResolverList(new String[]{"foo", "bar"}); // Bind the variable resolver to variable type 'sample' (eg. {sample:test}) VariableBinder binder = new VariableBinder(); binder.bindType("sample", vr);
VariableBinder
Constructor Summary | |
---|---|
VariableResolverList()
Creates a new variable resolver. |
|
VariableResolverList(List<String> values)
Creates a new variable resolver from the list of values. |
|
VariableResolverList(String[] values)
Creates a new variable resolver from the list of values. |
Method Summary | |
---|---|
boolean |
exists(String value)
Indicates whether the given value exists. |
Object |
resolve(String value)
Resolves the variable and returns the associated object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VariableResolverList()
public VariableResolverList(List<String> values)
values
- The list of values.public VariableResolverList(String[] values)
values
- The list of values.Method Detail |
---|
public boolean exists(String value)
true
only if the value can be resolved, that is
resolve(value) != null
.
exists
in interface VariableResolver
value
- The value to check for existence.
true
if the specified value can be resolved;
false
otherwise.public Object resolve(String value)
null
if the value a value exists, but should return
null
, if the value cannot be resolved.
If the implementation does not bind values to objects, this method should return the value if
it can be resolved otherwise, it should return null
.
resolve
in interface VariableResolver
value
- The value to resolve.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |