You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Michael Wyraz <mi...@evermind.de> on 2014/05/16 16:20:42 UTC
Wrong default types for validate/translate in AbstractTextField?
Hi,
I found something I do not understand and which is probably a bug. From
org.apache.tapestry5.corelib.base.AbstractTextField:
@Parameter(required = true, allowNull = false, defaultPrefix =
BindingConstants.TRANSLATE)
private FieldTranslator<Object> translate;
@Parameter(defaultPrefix = BindingConstants.VALIDATE)
@SuppressWarnings("unchecked")
private FieldValidator<Object> validate;
But the type of the default() methods differ:
final Binding defaultTranslate()
{
return defaultProvider.defaultTranslatorBinding("value",
resources);
}
final Binding defaultValidate()
{
return defaultProvider.defaultValidatorBinding("value", resources);
}
The interfaces "Binding" and "FieldTranslator" have nothing common. So I
cannot imagine that (and how) this could work.
Is it a bug?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org
Re: Wrong default types for validate/translate in AbstractTextField?
Posted by Lance Java <la...@googlemail.com>.
Hi Michael, in future... Please post to the user's mailing list. This list
is for the tapestry development team.
No, this is not a bug. Pages and components are singletons. Under the hood
they use bindings to get() and set() dynamic values at runtime. In this
instance the binding can get() a FieldTranslate instance at runtime.
You are probably more familiar with the prop: binding which can access a
property at runtime.
On 16 May 2014 18:02, "Michael Wyraz" <mi...@evermind.de> wrote:
> Hi,
>
> I found something I do not understand and which is probably a bug. From
> org.apache.tapestry5.corelib.base.AbstractTextField:
>
> @Parameter(required = true, allowNull = false, defaultPrefix =
> BindingConstants.TRANSLATE)
> private FieldTranslator<Object> translate;
>
> @Parameter(defaultPrefix = BindingConstants.VALIDATE)
> @SuppressWarnings("unchecked")
> private FieldValidator<Object> validate;
>
> But the type of the default() methods differ:
>
> final Binding defaultTranslate()
> {
> return defaultProvider.defaultTranslatorBinding("value",
> resources);
> }
>
> final Binding defaultValidate()
> {
> return defaultProvider.defaultValidatorBinding("value",
> resources);
> }
>
> The interfaces "Binding" and "FieldTranslator" have nothing common. So I
> cannot imagine that (and how) this could work.
>
> Is it a bug?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>
Re: Wrong default types for validate/translate in AbstractTextField?
Posted by Robert Zeigler <ro...@roxanemy.com>.
Not a bug. Defaults are allowed to supply either a literal default or a binding. The binding's "get" will evaluate to an object of the proper type. In fact, if memory serves, when you supply a literal value, tapestry wraps that in a "literal binding" anyway, because under the hood, all of those parameters are acting through bindings.
Robert
GATAATGCTATTTCTTTAATTTTCGAA
> On May 16, 2014, at 9:20 AM, Michael Wyraz <mi...@evermind.de> wrote:
>
> Hi,
>
> I found something I do not understand and which is probably a bug. From org.apache.tapestry5.corelib.base.AbstractTextField:
>
> @Parameter(required = true, allowNull = false, defaultPrefix = BindingConstants.TRANSLATE)
> private FieldTranslator<Object> translate;
>
> @Parameter(defaultPrefix = BindingConstants.VALIDATE)
> @SuppressWarnings("unchecked")
> private FieldValidator<Object> validate;
>
> But the type of the default() methods differ:
>
> final Binding defaultTranslate()
> {
> return defaultProvider.defaultTranslatorBinding("value", resources);
> }
>
> final Binding defaultValidate()
> {
> return defaultProvider.defaultValidatorBinding("value", resources);
> }
>
> The interfaces "Binding" and "FieldTranslator" have nothing common. So I cannot imagine that (and how) this could work.
>
> Is it a bug?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org