Patch: pluggable annotation support for stripes
-----------------------------------------------

                 Key: STS-316
                 URL: http://mc4j.org/jira/browse/STS-316
             Project: Stripes
          Issue Type: New Feature
          Components: Validation
            Reporter: Ignacio Coloma
         Assigned To: Tim Fennell


This is an attempt to give support for JPA annotations from inside Stripes. 
Enclosed is a patch that does the following:

1.- Convert the annotation mechanism of stripes to be pluggable, and therefore 
not limited to @Validate and @ValidateNestedProperties. In the line of 
scratching my itch, I have implemented a @ValidateNestedJpaProperties (I know 
the name sucks). 
2.- There is an AnnotationConverter interface that translates any kind of 
annotation to the internal Stripes representation (ValidationMetadata). For 
example, the tag above will seek the nested attributes and convert standard JPA 
annotations (required, length, etc) into stripes internal representation.
3.- These annotation converters are stackable, but I still have to figure the 
desired behaviour. The idea is to allow this kind of situation:

@ValidateNestedJpaProperties
@ValidateNestedProperties(<fine tuning here>)
private PersistentObject instance;

Where the second annotation would override the first one(for example, changing 
length or required of certain attributes). It is more or less implemented, but 
I still don't have a very clear idea of the expected behaviour.

If this works, annotations would be pluggable: you can give support to 
Hibernate Annotations, JPA annotations, webwork annotations, all inside stripes 
and override certain parts.

Caveats: configuration is not finished (only provided a default config with 
Validate and ValidateNestedProperties annotations) and haven't checked fully if 
something broke. Some more tests should be implemented, but they are easy. 
Anyways, I wanted to submit this to get some feedback (this is only a proposal 
that might not be accepted). The big size is because I need an ejb3 jar file to 
be able to test annotation support.

Tim, your code is great!! Amazingly easy to understand.

-- 
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

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to