...
See Type Coercer Service for the list of build-in coercions.
Parameter Type Coercions
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
| ||||||||||
Wiki Markup | ||||||||||
{float}
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=coercion,parameters}
{float} |
Tapestry automatically handles type coercions for component parameters.
Type coercions occur when a value passed into a parameter (as bound in a template or in an annotation) does not match the type of the parameter.For example, consider the Count component:
Code Block | ||
---|---|---|
| ||
public class Count { @Parameter private int start = 1; @Parameter(required = true) private int end; @Parameter private int value; . . . |
Here, the type of all three parameters is int
.
...
The TypeCoercer service is responsible for this type coercion. This service is part of the tapestry-ioc module. The service is quite extensible, allowing for new types and coercions to be added easily. The TapestryModule contributes a few additional coercions into the TypeCoercer service.
Scrollbar |
---|