/**
  * return accessors
  *
  * @param mappedProperty
  * @return
  */
 private PropertyAccessor buildPropertyAccessor(Property mappedProperty) {
   if (mappedProperty.isBackRef()) {
     PropertyAccessor ac = mappedProperty.getPropertyAccessor(null);
     if (ac != null) return ac;
   }
   return accessor;
 }
 private PropertyAccessor buildPropertyAccessor(Property mappedProperty) {
   if (mappedProperty.isBackRef()) {
     return mappedProperty.getPropertyAccessor(null);
   } else {
     return PropertyAccessorFactory.getDynamicMapPropertyAccessor();
   }
 }
Ejemplo n.º 3
0
 @SuppressWarnings("unchecked")
 private void addSubElement(Property property, ValidatableElement element) {
   if (property != null && property.isComposite() && !property.isBackRef()) {
     Component component = (Component) property.getValue();
     if (component.isEmbedded()) return;
     PropertyAccessor accessor =
         PropertyAccessorFactory.getPropertyAccessor(property, EntityMode.POJO);
     Getter getter = accessor.getGetter(element.clazz, property.getName());
     ClassValidator validator = new ClassValidator(getter.getReturnType());
     ValidatableElement subElement =
         new ValidatableElement(getter.getReturnType(), validator, getter);
     Iterator properties = component.getPropertyIterator();
     while (properties.hasNext()) {
       addSubElement((Property) properties.next(), subElement);
     }
     if (subElement.getSubElements().size() != 0 || subElement.validator.hasValidationRules()) {
       element.addSubElement(subElement);
     }
   }
 }