Hello list,
I'm working with stripes since a year or so. It's my favorite web
framework. But every time I'm using ValidateNestedProperties in a
ActionBean with 2 events(one for loading the data, one for updating
it) I have to break the DRY rule. This is from one of my ActionBeans:
@ValidateNestedProperties( {
@Validate(on="update", field = "id", encrypted = true, required = true),
@Validate(on="update", field = "version", encrypted = true, required =
true),
@Validate(on="update", field = "wkn", required = true, minlength = 6),
@Validate(on="update", field = "isin", required = true, minlength = 6),
@Validate(on="update", field = "name", required = true, minlength = 1),
@Validate(on="update", field = "lowerBorder", required = true,
minvalue = 0.000000001),
@Validate(on="update", field = "upperBorder", required = true,
minvalue = 0.000000001),
@Validate(on="update", field = "dynamicBorder", required = true,
minvalue = 0.000000001),
@Validate(on="update", field = "dynamicBorderStartDate", required =
true) })
public void setItem(DtoSingleStockMonitoringConfiguration item) {
this.item = item;
}
Wouldn't it be better to have the option to define a "on" in the
ValidateNestedProperty Annotation, which can be overridden in the
@Validate Annotation? So my sample would look like this:
@ValidateNestedProperties(
on="update",
validations={
@Validate(field = "id", encrypted = true, required = true),
@Validate(field = "version", encrypted = true, required = true),
@Validate(field = "wkn", required = true, minlength = 6),
@Validate(field = "isin", required = true, minlength = 6),
@Validate(field = "name", required = true, minlength = 1),
@Validate(field = "lowerBorder", required = true, minvalue =
0.000000001),
@Validate(field = "upperBorder", required = true, minvalue =
0.000000001),
@Validate(field = "dynamicBorder", required = true, minvalue =
0.000000001),
@Validate(field = "dynamicBorderStartDate", required = true) })
public void setItem(DtoSingleStockMonitoringConfiguration item) {
this.item = item;
}
Thanks for your opinions,
Richard
--
Richard Hauswald
Blog: http://tnfstacc.blogspot.com/
LinkedIn: http://www.linkedin.com/in/richardhauswald
Xing: http://www.xing.com/profile/Richard_Hauswald
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users