public class AnnotationValidatorMetaDataReader extends Object implements ValidatorMetaDataReader, Serializable
AnnotationValidatorMetaDataReader reads validation meta-data from annotations.
This class reads a annotation as follows: You pass in the base package of the
annotations it defaults to "org.boon.annotations.validation". It then takes
the name
of the ValidatorMetaData
and
capitalizes the first letter. Thus if you pass the package
"com.my.company.annotations", and
ValidatorMetaData.name = "required"
, then it will look for an
annotation called com.my.company.annotations.Required. The idea behind this is
that you can use annotation without polluting your model classes with Boon
annotations.
The parent class that owns the annotation should have annotation as follows:
Constructor and Description |
---|
AnnotationValidatorMetaDataReader() |
Modifier and Type | Method and Description |
---|---|
List<ValidatorMetaData> |
readMetaData(Class<?> clazz,
String propertyName)
Read the meta-data from annotations.
|
void |
setValidationAnnotationPackages(Set<String> validationAnnotationPackages)
We allow a set of validation annotation packages to be configured.
|
public List<ValidatorMetaData> readMetaData(Class<?> clazz, String propertyName)
readMetaData
in interface ValidatorMetaDataReader
clazz
- The class that contains the annotations.propertyName
- The name of the property that we are reading
the annotation meta-data from.Copyright © 2014. All rights reserved.