in tapestry-framework/src/org/apache/tapestry/BaseComponentTemplateLoader.java [404:466]
private void addExpressionBinding(
IComponent component,
IComponentSpecification spec,
String name,
String expression,
ILocation location)
{
// If matches a formal parameter name, allow it to be set
// unless there's already a binding.
boolean isFormal = (spec.getParameter(name) != null);
if (isFormal)
{
if (component.getBinding(name) != null)
throw new ApplicationRuntimeException(
Tapestry.format(
"BaseComponent.dupe-template-expression",
name,
component.getExtendedId(),
_loadComponent.getExtendedId()),
component,
location,
null);
}
else
{
if (!spec.getAllowInformalParameters())
throw new ApplicationRuntimeException(
Tapestry.format(
"BaseComponent.template-expression-for-informal-parameter",
name,
component.getExtendedId(),
_loadComponent.getExtendedId()),
component,
location,
null);
// If the name is reserved (matches a formal parameter
// or reserved name, caselessly), then skip it.
if (spec.isReservedParameterName(name))
throw new ApplicationRuntimeException(
Tapestry.format(
"BaseComponent.template-expression-for-reserved-parameter",
name,
component.getExtendedId(),
_loadComponent.getExtendedId()),
component,
location,
null);
}
IBinding binding =
new ExpressionBinding(
_pageSource.getResourceResolver(),
_loadComponent,
expression,
location);
component.setBinding(name, binding);
}