Interface VariableResolverX
-
- All Superinterfaces:
VariableResolver
public interface VariableResolverX extends VariableResolver
An extension ofVariableResolverto have more control to resolve the variables.With
VariableResolver,VariableResolver.resolveVariable(java.lang.String)is called to resolve a top-level variable (for example,${a.b.c}whereais a top-level variable).With
VariableResolverX,resolveVariable(XelContext, Object, Object)is called to resolve not only top-level variables but also properties (for example,${a.b.c}wherebandcare properties).If
VariableResolverXis implemented,VariableResolver.resolveVariable(java.lang.String)is ignored. In other words, EL evaluator always invokeresolveVariable(XelContext, Object, Object).Notice you have to follow the same rule to invoke the
resolveVariablemethod. And there is a method calledEvaluators.resolveVariable(org.zkoss.xel.XelContext, org.zkoss.xel.VariableResolver, java.lang.Object, java.lang.Object)that can be used to do the job.- Since:
- 5.0.0
- Author:
- tomyeh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ObjectresolveVariable(XelContext ctx, java.lang.Object base, java.lang.Object name)Resolves the the given variable on the given base object.-
Methods inherited from interface org.zkoss.xel.VariableResolver
resolveVariable
-
-
-
-
Method Detail
-
resolveVariable
java.lang.Object resolveVariable(XelContext ctx, java.lang.Object base, java.lang.Object name) throws XelException
Resolves the the given variable on the given base object.It resolves not only top-level variables but also properties. For example, when resolving
foo.duke,resolveVariable(ctx, null, "foo")is called first. And if it returns an non-null object,resolveVariable(ctx, foo, "duke")is called then (where we assume the returned object in the previous call isfoo).- Parameters:
ctx- the context of this evaluationbase- the base object whose property value is to be returned, or null to resolve a top-level variable.name- the name of the variable (or property) to resolve- Throws:
XelException
-
-