in tapestry-framework/src/org/apache/tapestry/binding/ExpressionBinding.java [427:501]
private void checkForInvariant(int start, String[] split)
{
// For now, all of our conditions are two properties
// from a root component.
if (split.length - start != 2)
return;
try
{
if (!Ognl.isSimpleNavigationChain(_parsedExpression, getOgnlContext()))
return;
}
catch (OgnlException ex)
{
throw new BindingException(
Tapestry.format(
"ExpressionBinding.unable-to-resolve-expression",
_expression,
_root),
this,
ex);
}
String first = split[start];
if (first.equals("listeners"))
{
_invariant = true;
// Could cast to AbstractComponent, get listenersMap, etc.,
// but this is easier.
_cachedValue = resolveProperty();
return;
}
if (first.equals("assets"))
{
String name = split[start + 1];
_invariant = true;
_cachedValue = _root.getAsset(name);
return;
}
if (first.equals("beans"))
{
String name = split[start + 1];
IBeanSpecification bs = _root.getSpecification().getBeanSpecification(name);
if (bs == null || bs.getLifecycle() != BeanLifecycle.PAGE)
return;
// Again, could cast to AbstractComponent, but this
// is easier.
_invariant = true;
_cachedValue = resolveProperty();
return;
}
if (first.equals("bindings"))
{
String name = split[start + 1];
_invariant = true;
_cachedValue = _root.getBinding(name);
return;
}
// Not a recognized pattern for conversion
// to invariant.
}