I implemented a constraint generator for cayenne mapping files in the t5cayenne 
project awhile back.
http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/services/CayenneConstraintGenerator.java

Current trunk is compatible with 5.2; need to do another release of the project.

Cheers,

Robert

On Sep 28, 2010, at 9/287:35 AM , LLTYK wrote:

> 
> I'd like for something like <t:textfield value="bean.textvalue" /> to somehow
> know what validators (length,etc) to use. 
> 
> There seems to be a way to do this with annotations on the bean's fields,
> but I am using Cayenne which stores constraint information in an xml file,
> and do not want to duplicate this by adding annotations. 
> 
> So my ValidationConstraintGenerator would need to know what bean class and
> which property to look up things from the xml file. In the t5-cayenne
> project the ValidationConstraintGenerator pulls the BeanEditContext and
> PropertyEditContext from the Environment, and gets the necessary information
> from those. These are only available inside a BeanEditor though.
> 
> Is there some other method for generating validators automatically? The
> internal AccessableObjectAnnotationProvider looks interesting, as it can
> access the property and bean class, and so would be able to mock up an
> @Validate annotation. It doesn't look like it's meant to be overridden
> though.
> -- 
> View this message in context: 
> http://tapestry-users.832.n2.nabble.com/Is-there-a-way-to-automatically-generate-validation-constraints-on-standalone-fields-tp5579233p5579233.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to