ValidateNestedProperties and custom type converters don't work on private fields
--------------------------------------------------------------------------------
Key: STS-753
URL: http://www.stripesframework.org/jira/browse/STS-753
Project: Stripes
Issue Type: Bug
Components: Validation
Affects Versions: Release 1.5.2
Environment: OSX 10.6, JDK6 newest, Tomcat 6.0.16
Reporter: Janne Jalkanen
Priority: Minor
The following code does not work as expected - the built-in FloatTypeConverter
is used.
{code}
@ValidateNestedProperties({
@Validate(field="x1", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="y1", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="x2", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="y2", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
})
private Thing m_thing;
{code}
However, when the validation is done against the setThing() method, the given
StrictFloatTypeConverter.class
is used as requested:
{code}
@ValidateNestedProperties({
@Validate(field="x1", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="y1", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="x2", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
@Validate(field="y2", required=true, minvalue=0.0,
converter=StrictFloatTypeConverter.class),
})
public void setThing( Thing t )
{
m_thing = t;
}
{code}
The Thing class looks something like this:
{code}
public class Thing
{
public float x1;
public float x2;
public float y1;
public float y2;
public float getX1()
{
return x1;
}
public float getX2()
{
return x2;
}
public float getY1()
{
return y1;
}
public float getY2()
{
return y2;
}
public void setX1( float x1 )
{
this.x1 = x1;
}
public void setX2( float x2 )
{
this.x2 = x2;
}
public void setY1( float y1 )
{
this.y1 = y1;
}
public void setY2( float y2 )
{
this.y2 = y2;
}
}
{code}
So at least this should be clarified in the documentation, but I suspect this
is an actual bug, since documentation suggests that you can also use the
annotation on the field itself.
(I'm using 1.5.2 'cos that's what's available in Maven... *ahem* STS-738
thankyouverymuch ;-)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development