Object boundValue = parameterBinding.get();
result = typeCoercer.coerce(boundValue, fieldType);
} catch (RuntimeException ex)
{
throw new TapestryException(String.format(
"Failure reading parameter '%s' of component %s: %s", parameterName,
icr.getCompleteId(), InternalUtils.toMessage(ex)), parameterBinding, ex);
}
if (result == null && !allowNull)
{
throw new TapestryException(
String.format(
"Parameter '%s' of component %s is bound to null. This parameter is not allowed to be null.",
parameterName, icr.getCompleteId()), parameterBinding, null);
}
return result;
}
private void writeToBinding(Object newValue)
{
// An unbound parameter acts like a simple field
// with no side effects.
if (parameterBinding == null)
{
return;
}
try
{
Object coerced = typeCoercer.coerce(newValue, parameterBinding.getBindingType());
parameterBinding.set(coerced);
} catch (RuntimeException ex)
{
throw new TapestryException(String.format(
"Failure writing parameter '%s' of component %s: %s", parameterName,
icr.getCompleteId(), InternalUtils.toMessage(ex)), icr, ex);
}
}