Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
is it possible to validate datatypes fields using annotations ?

for example:
if i have the class:

Java
public class Worker{
   
 @NameAnno
  private String name;
 @EmailAnno
  private String email;

  public Worker()
  {
     name = "AnyName";
     email = "notLegal&email.blabla"
  }
}


so when the constructor will run, exception will happened.
my main goal is in each assign into the strings , auto validate will happened only with annotations and with out calling to other checking method.

thanks !
Posted
Updated 6-Jun-13 9:03am
v3

1 solution

Try reading the documentation for JaValid[^]. Might be of use.
 
Share this answer
 
Comments
amiraf123 7-Jun-13 13:00pm    
Hi, first of all , thank you.
but still it doesnt halp me.
i need all validation will happened in auto mode, without calling to validate method with object argument. so when wrong input will assign into the string , an error message will be displayed. - again, without calling to validate method.
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900