-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Semantic Validation
PostPosted: Thu May 05, 2011 6:38 pm 
Newbie

Joined: Thu May 05, 2011 6:15 pm
Posts: 3
I realize that this is the "Bean" validation framework, but I was wondering if there is any way to validate a value without necessarily tying it to a bean? We have a Swing-based UI which is not always bound to a bean. I would like to be able to do something like this:

String idOrURI = "protein.accession.swissprot";
...
public Set<ConstraintViolation> validate(String idOrURI, Object value){
Validator validator = ValidatorFactory.getValidator(idOrURI); // get validator using an ID or an ontology URI
return validator.validate(value);
}

To validate the value found in a Swing component I would assign a name (in the form of an ID or URI) to a component and then inject validators, and listeners to the component, so that it would validate whenever the user changes the value. By separating the validation criteria from either the bean used to store the value, or the UI component, I could use the same set of validation constraints to the same field regardless of where it occurs within the app.

I imagine that the same type of approach would also be useful for validating values from web UI components.

Any advice would be appreciated.

Regards,

Mark


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.