[ http://mc4j.org/jira/browse/STS-395?page=comments#action_10736 ] 
            
Ben Gunter commented on STS-395:
--------------------------------

This behavior is intentional. If you apply a @Validate or @AllowBinding to the 
field itself, then binding will be allowed for the field as well as its 
properties. E.g.:

@Validate
@ValidateNestedProperties({
    @Validate(field="iceCream"),
    @Validate(field="toppings"),
    @Validate(field="isMelting")
})
private Sundae s;

The idea behind this was that if the developer wants to pre-populate the "s" 
field (not from a parameter) then the field can be protected from binding while 
allowing its properties to be populated from parameters.

> @StrictBinding only works on nested fields, not the object itself
> -----------------------------------------------------------------
>
>                 Key: STS-395
>                 URL: http://mc4j.org/jira/browse/STS-395
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.5
>            Reporter: Jeff Ferber
>         Assigned To: Tim Fennell
>
> This relates to Ben Gunter's @StrictBinding library, which I understand is 
> being incorporated into Stripes 1.5.
> I think I found a bug. 
> Although @ValidateNestedProperties correctly signals that the fields within 
> are permitted for binding, StrictBinding prevents the object itself from 
> binding.  (Important when a TypeConverter is being used.)  For example:
> @ValidateNestedProperties({
>               @Validate(field="iceCream"),
>               @Validate(field="toppings"),
>               @Validate(field="isMelting")
>       })
> private Sundae s;
> s.iceCream would bind, but s would not.
>  I think I fixed it in AnnotatedBindAccessEvaluator by adding the line 
> indicated below:
> for (Validate validate : validates) {
>                         if (validate != null)
>                         {
>                             allowGlob.add(propertyName, validate.field());
>                             allowGlob.add(propertyName);  // <--------------- 
> does this fix it?
>                         }
>                     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to