AnnotationValidatorMetaDataReader reads validation meta-data from annotations.
This class reads a annotation as follows: You pass in the base package of the annotatoins it defaults to "org.crank.annotations.validation". It then takes the name
of the ValidatorMetaData
and captilalizes the first letter. Thus if you pass the package "com.mycompany.annotations", and ValidatorMetaData.name = "required"
, then it will look for an annotation called com.mycompany.annotations.Required. The idea behind this is that you can use annotation without polluting your model classes with Crank annotations.
The parent class that owns the annotation should have annotation as follows:
@Required @Length (min=10, max=100)public String getFirstName(){... @Required @Range (min=10, max=100) public void setAge() {...The firstName corresponds to a property of the Foo class. The firstName is associated with the validation rules required and length. The length validation rule states the minimum and maximum allowed number of characters with the min and max parameters.
Two different frameworks read this meta-data (curently). Our validation framework, which is mostly geared towards server-side validation and our client-side JavaScript framework, which is geared towards producing client-side JavaScript.
@author Rick Hightower
|
|