[forge-issues] [JBoss JIRA] (FORGE-1618) Command constraint-new-validator to create a new validator implementation
Antonio Goncalves (JIRA)
issues at jboss.org
Sun Mar 2 11:40:47 EST 2014
[ https://issues.jboss.org/browse/FORGE-1618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Goncalves updated FORGE-1618:
-------------------------------------
Component/s: Java EE
(was: Scaffold)
> Command constraint-new-validator to create a new validator implementation
> -------------------------------------------------------------------------
>
> Key: FORGE-1618
> URL: https://issues.jboss.org/browse/FORGE-1618
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.1.1.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> An existing constraint can have several implementations of different types. The following commands will create two implementations of the {{Max}} constraints: one for type {{Number}} and one for {{String}} :
> {code}
> constraint-new-validator --named MaxValidatorForNumber --type Number --targetConstraint Max
> constraint-new-validator --named MaxValidatorForString --type String --targetConstraint Max
> {code}
> The generated code would look like this for Number :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> @Override
> public void initialize(URL url) {
> }
> @Override
> public boolean isValid(Number value, ConstraintValidatorContext context) {
> return false;
> }
> }
> {code}
> And like that for String :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, String> {
> @Override
> public void initialize(URL url) {
> }
> @Override
> public boolean isValid(String value, ConstraintValidatorContext context) {
> return false;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list