コード例 #1
0
  private void parsePropertyLevelOverrides(
      List<GetterType> getters, Class<?> beanClass, String defaultPackage) {
    List<String> getterNames = newArrayList();
    for (GetterType getterType : getters) {
      String getterName = getterType.getName();
      if (getterNames.contains(getterName)) {
        throw log.getIsDefinedTwiceInMappingXmlForBeanException(getterName, beanClass.getName());
      } else {
        getterNames.add(getterName);
      }
      boolean containsMethod =
          ReflectionHelper.containsMethodWithPropertyName(beanClass, getterName);
      if (!containsMethod) {
        throw log.getBeanDoesNotContainThePropertyException(beanClass.getName(), getterName);
      }
      final Method method = ReflectionHelper.getMethodFromPropertyName(beanClass, getterName);

      // ignore annotations
      boolean ignoreGetterAnnotation =
          getterType.getIgnoreAnnotations() == null ? false : getterType.getIgnoreAnnotations();
      if (ignoreGetterAnnotation) {
        annotationProcessingOptions.ignorePropertyLevelConstraintAnnotationsOnMember(method);
      }

      // valid
      if (getterType.getValid() != null) {
        addCascadedMember(beanClass, method);
      }

      // constraints
      for (ConstraintType constraint : getterType.getConstraint()) {
        MetaConstraint<?> metaConstraint =
            createMetaConstraint(constraint, beanClass, method, defaultPackage);
        addMetaConstraint(beanClass, metaConstraint);
      }
    }
  }