Package org.springframework.core

Examples of org.springframework.core.MethodParameter


    for (int i = 0; i < propertyNames.length; i++) {
      String propertyName = propertyNames[i];
      try {
        PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
        Object autowiredArgument = resolveDependency(
            new DependencyDescriptor(new MethodParameter(pd.getWriteMethod(), 0), false),
            beanName, autowiredBeanNames, converter);
        if (autowiredArgument != null) {
          pvs.addPropertyValue(propertyName, autowiredArgument);
        }
        for (Iterator it = autowiredBeanNames.iterator(); it.hasNext();) {
View Full Code Here


          argsToUse = new Object[argsToResolve.length];
          for (int i = 0; i < argsToResolve.length; i++) {
            Object argValue = argsToResolve[i];
            if (argValue instanceof AutowiredArgumentMarker) {
              argValue = resolveAutowiredArgument(
                  new MethodParameter(constructorToUse, i), beanName, null, converter);
            }
            else if (argValue instanceof BeanMetadataElement) {
              argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
            }
            argsToUse[i] = converter.convertIfNecessary(argValue, paramTypes[i],
                new MethodParameter(constructorToUse, i));
          }
        }
      }
    }
View Full Code Here

          argsToUse = new Object[argsToResolve.length];
          for (int i = 0; i < argsToResolve.length; i++) {
            Object argValue = argsToResolve[i];
            if (argValue instanceof AutowiredArgumentMarker) {
              argValue = resolveAutowiredArgument(
                  new MethodParameter(factoryMethodToUse, i), beanName, null, converter);
            }
            else if (argValue instanceof BeanMetadataElement) {
              argValue = valueResolver.resolveValueIfNecessary("factory method argument", argValue);
            }
            argsToUse[i] = converter.convertIfNecessary(argValue, paramTypes[i],
                new MethodParameter(factoryMethodToUse, i));
          }
        }
      }
    }
View Full Code Here

              mbd.getResourceDescription(), beanName, paramIndex, paramType,
              "Ambiguous " + methodType + " argument types - " +
              "did you specify the correct bean references as " + methodType + " arguments?");
        }
        try {
          MethodParameter param = MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex);
          Object autowiredArgument = resolveAutowiredArgument(param, beanName, autowiredBeanNames, converter);
          args.rawArguments[paramIndex] = autowiredArgument;
          args.arguments[paramIndex] = autowiredArgument;
          args.preparedArguments[paramIndex] = new AutowiredArgumentMarker();
          resolveNecessary = true;
View Full Code Here

    Class[] paramTypes = handlerMethod.getParameterTypes();
    Object[] args = new Object[paramTypes.length];
    Class<?> handlerType = handler.getClass();
    for (int i = 0; i < args.length; i++) {
      MethodParameter methodParam = new MethodParameter(handlerMethod, i);
      GenericTypeResolver.resolveParameterType(methodParam, handlerType);
      Class paramType = methodParam.getParameterType();
      Object argValue = resolveCommonArgument(methodParam, webRequest, thrownException);
      if (argValue != WebArgumentResolver.UNRESOLVED) {
        args[i] = argValue;
      }
      else {
View Full Code Here

  /**
   * Copy constructor.
   * @param original the original descriptor to create a copy from
   */
  public DependencyDescriptor(DependencyDescriptor original) {
    this.methodParameter = (original.methodParameter != null ? new MethodParameter(original.methodParameter) : null);
    this.field = original.field;
    this.declaringClass = original.declaringClass;
    this.methodName = original.methodName;
    this.parameterTypes = original.parameterTypes;
    this.parameterIndex = original.parameterIndex;
View Full Code Here

      if (this.fieldName != null) {
        this.field = this.declaringClass.getDeclaredField(this.fieldName);
      }
      else {
        if (this.methodName != null) {
          this.methodParameter = new MethodParameter(
              this.declaringClass.getDeclaredMethod(this.methodName, this.parameterTypes), this.parameterIndex);
        }
        else {
          this.methodParameter = new MethodParameter(
              this.declaringClass.getDeclaredConstructor(this.parameterTypes), this.parameterIndex);
        }
        for (int i = 1; i < this.nestingLevel; i++) {
          this.methodParameter.increaseNestingLevel();
        }
View Full Code Here

   * @param pd the PropertyDescriptor for the property
   * @return a corresponding MethodParameter object
   */
  public static MethodParameter getWriteMethodParameter(PropertyDescriptor pd) {
    if (pd instanceof GenericTypeAwarePropertyDescriptor) {
      return new MethodParameter(
          ((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodParameter());
    }
    else {
      return new MethodParameter(pd.getWriteMethod(), 0);
    }
  }
View Full Code Here

    if (this.propertyType == null) {
      if (this.readMethod != null) {
        this.propertyType = GenericTypeResolver.resolveReturnType(this.readMethod, this.beanClass);
      }
      else {
        MethodParameter writeMethodParam = getWriteMethodParameter();
        if (writeMethodParam != null) {
          this.propertyType = writeMethodParam.getParameterType();
        }
        else {
          this.propertyType = super.getPropertyType();
        }
      }
View Full Code Here

  public synchronized MethodParameter getWriteMethodParameter() {
    if (this.writeMethod == null) {
      return null;
    }
    if (this.writeMethodParameter == null) {
      this.writeMethodParameter = new MethodParameter(this.writeMethod, 0);
      GenericTypeResolver.resolveParameterType(this.writeMethodParameter, this.beanClass);
    }
    return this.writeMethodParameter;
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.MethodParameter

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.