Package org.springframework.ide.eclipse.core.model.validation

Examples of org.springframework.ide.eclipse.core.model.validation.ValidationProblemAttribute


    // For non-factory beans validate it's init-method and destroy-method
    String mergedClassName = mergedBd.getBeanClassName();
    if (valueRegion != null && mergedClassName != null) {
      // add rename refactoring option
      validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
          QuickfixProcessorFactory.RENAME_METHOD, null, new ValidationProblemAttribute("CLASS",
              mergedClassName));
    }

    if (rule != null) {
      context.setCurrentRuleDefinition(ruleDefinition);
View Full Code Here


    // destroy-method
    String mergedClassName = mergedBd.getBeanClassName();
    if (valueRegion != null && mergedClassName != null) {

      validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
          QuickfixProcessorFactory.RENAME_METHOD, null, new ValidationProblemAttribute("CLASS",
              mergedClassName), new ValidationProblemAttribute("METHOD", attribute.getNodeValue()));
    }

    if (initDestroyMethodRule != null) {
      context.setCurrentRuleDefinition(initRuleDefinition);
      initDestroyMethodRule.validate(parentBean, context, null);
View Full Code Here

    String mergedClassName = mergedBd.getBeanClassName();

    if (valueRegion != null && mergedClassName != null) {
      // add rename refactoring option
      validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
          QuickfixProcessorFactory.RENAME_PROPERTY, null, new ValidationProblemAttribute("CLASS",
              mergedClassName));
    }

    if (deprecationRule != null) {
      context.setCurrentRuleDefinition(depracationRuleDefinition);
View Full Code Here

        // Skip validating factory beans which are created by another
        // factory bean
        if (factoryBd.getFactoryBeanName() == null) {
          if (factoryBd.isAbstract() || factoryBd.getBeanClassName() == null) {
            context.error(bean, "INVALID_FACTORY_BEAN", "Referenced factory bean '" + beanName
                + "' is invalid (abstract or no bean class)", new ValidationProblemAttribute("BEAN",
                beanName));
          }
          else {

            // Validate non-static factory method in factory bean
            // Factory beans with factory methods can only be
            // validated during runtime - so skip them
            if (factoryBd.getFactoryMethodName() == null) {
              validateFactoryMethod(bean, factoryBd.getBeanClassName(), methodName,
                  (bean.getConstructorArguments().size() > 0 ? bean.getConstructorArguments().size()
                      : -1), Static.NO, context, typeEngine);
            }
          }
        }
      }
      catch (NoSuchBeanDefinitionException e) {

        // Skip error "parent name is equal to bean name"
        if (!e.getBeanName().equals(bean.getElementName())) {
          context.error(bean, "UNDEFINED_FACTORY_BEAN", "Factory bean '" + beanName + "' not found",
              new ValidationProblemAttribute("BEAN", beanName));
        }
      }
    }
  }
View Full Code Here

    try {
      if (type != null) {
        String methodName = attribute.getNodeValue();
        if (Introspector.findMethod(type, methodName, -1, Public.DONT_CARE, Static.DONT_CARE) == null) {
          context.error(n, "METHOD_NOT_FOUND", "Method '" + methodName + "' not found in class '" + className
              + "'", new ValidationProblemAttribute("METHOD", methodName),
              new ValidationProblemAttribute("CLASS", className));
        }
      }
    }
    catch (Exception e) {
      SpringCore.log(e);
View Full Code Here

      IType type = JdtUtils.getJavaType(context.getRootElementProject(), className);

      // Verify class is found
      if (type == null || (type.getDeclaringType() != null && className.indexOf('$') == -1)) {
        context.error(n, "CLASS_NOT_FOUND", "Class '" + className + "' not found",
            new ValidationProblemAttribute("CLASS", className));
        return;
      }

      try {
        // Check if type is part for give type hierarchy
View Full Code Here

      try {
        context.getCompleteRegistry().getBeanDefinition(beanName);
      }
      catch (NoSuchBeanDefinitionException e) {
        context.warning(n, "UNDEFINED_REFERENCED_BEAN", "Referenced bean '" + beanName + "' not found",
            new ValidationProblemAttribute("BEAN", beanName));
      }
      catch (BeanDefinitionStoreException e) {
        // Need to make sure that the parent of a parent does not use placeholders
        Throwable exp = e;
        boolean placeHolderFound = false;
        while (exp != null && exp.getCause() != null) {
          String msg = exp.getCause().getMessage();
          if (msg.contains(SpringCoreUtils.PLACEHOLDER_PREFIX)
              && msg.contains(SpringCoreUtils.PLACEHOLDER_SUFFIX)) {
            placeHolderFound = true;
            break;
          }
          exp = exp.getCause();
        }
        if (!placeHolderFound) {
          context.warning(n, "UNDEFINED_REFERENCED_BEAN", "Refrenced bean '" + beanName + "' not found",
              new ValidationProblemAttribute("BEAN", beanName));
        }
      }
    }
  }
View Full Code Here

            IType type = JdtUtils.getJavaType(context.getRootElementProject(), className);
            if (type != null) {
              IField field = type.getField(fieldName);
              if (!field.exists()) {
                context.error(n, "FIELD_NOT_FOUND", "Field '" + fieldName + "' not found on class '"
                    + className + "'", new ValidationProblemAttribute("CLASS", className),
                    new ValidationProblemAttribute("FIELD", fieldName));
              }
              else if (!type.isEnum() && !Flags.isStatic(field.getFlags())) {
                context.error(n, "FIELD_NOT_STATIC", "Field '" + fieldName + "' on class '" + className
                    + "' is not static", new ValidationProblemAttribute("CLASS", className),
                    new ValidationProblemAttribute("FIELD", fieldName));
              }
            }
            else {
              context.error(n, "CLASS_NOT_FOUND", "Class '" + className + "' not found",
                  new ValidationProblemAttribute("CLASS", className));
            }
          }
        }
      }
      catch (JavaModelException e) {
View Full Code Here

          IType type = JdtUtils.getJavaType(context.getRootElementProject(), className);

          // Verify class is found
          if (type == null || (type.getDeclaringType() != null && className.indexOf('$') == -1)) {
            context.error(child, "CLASS_NOT_FOUND", "Class '" + className + "' not found",
                new ValidationProblemAttribute("Class", className));
            continue;
          }

          try {
            if (!type.isInterface()) {
View Full Code Here

        try {
          context.getCompleteRegistry().getBeanDefinition(parentName);
        }
        catch (NoSuchBeanDefinitionException e) {
          context.warning(bean, "UNDEFINED_PARENT_BEAN", "Parent bean '" + parentName + "' not found",
              new ValidationProblemAttribute("BEAN", parentName),
              new ValidationProblemAttribute("BEAN_NAME", bean.getElementName()));
        }
        catch (BeanDefinitionStoreException e) {

          // Need to make sure that the parent of a parent does not use placeholders
          Throwable exp = e;
          boolean placeHolderFound = false;
          while (exp != null && exp.getCause() != null) {
            String msg = exp.getCause().getMessage();
            if (msg.contains(SpringCoreUtils.PLACEHOLDER_PREFIX)
                && msg.contains(SpringCoreUtils.PLACEHOLDER_SUFFIX)) {
              placeHolderFound = true;
              break;
            }
            exp = exp.getCause();
          }
          if (!placeHolderFound) {
            context.warning(bean, "UNDEFINED_PARENT_BEAN", "Parent bean '" + parentName + "' not found",
                new ValidationProblemAttribute("BEAN", parentName),
                new ValidationProblemAttribute("BEAN_NAME", bean.getElementName()));
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.core.model.validation.ValidationProblemAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.