/** add cascade validation and constraints from xml mappings */
private void addXmlConstraints(Class<?> beanClass, MetaBean metabean)
throws IllegalAccessException, InvocationTargetException {
for (MetaConstraint<?, ? extends Annotation> meta : factoryContext.getFactory()
.getMetaConstraints(beanClass)) {
MetaProperty metaProperty;
if (meta.getAccessStrategy() == null) { // class level
metaProperty = null;
} else { // property level
metaProperty =
metabean.getProperty(meta.getAccessStrategy().getPropertyName());
if (metaProperty == null) {
metaProperty = addMetaProperty(metabean,
meta.getAccessStrategy().getPropertyName(),
meta.getAccessStrategy().getJavaType());
}
}
Class<? extends ConstraintValidator<?, ?>>[] constraintClasses =
findConstraintValidatorClasses(meta.getAnnotation(), null);
applyConstraint(meta.getAnnotation(), constraintClasses, metaProperty, beanClass,
meta.getAccessStrategy(), new AppendValidationToMeta(
metaProperty == null ? metabean : metaProperty));
}
for (AccessStrategy access : factoryContext.getFactory().getValidAccesses(beanClass)) {
MetaProperty metaProperty = metabean.getProperty(access.getPropertyName());
if (metaProperty == null) {
metaProperty =
addMetaProperty(metabean, access.getPropertyName(), access.getJavaType());
}
processValid(metaProperty, access);