Package org.springframework.core

Examples of org.springframework.core.MethodParameter


      return StringUtils.uncapitalize(this.writeMethod.getName().substring(index));
    }
  }

  private MethodParameter resolveMethodParameter() {
    MethodParameter read = resolveReadMethodParameter();
    MethodParameter write = resolveWriteMethodParameter();
    if (write == null) {
      if (read == null) {
        throw new IllegalStateException("Property is neither readable nor writeable");
      }
      return read;
    }
    if (read != null) {
      Class<?> readType = read.getParameterType();
      Class<?> writeType = write.getParameterType();
      if (!writeType.equals(readType) && writeType.isAssignableFrom(readType)) {
        return read;
      }
    }
    return write;
View Full Code Here


  private MethodParameter resolveReadMethodParameter() {
    if (getReadMethod() == null) {
      return null;
    }
    return resolveParameterType(new MethodParameter(getReadMethod(), -1));
  }
View Full Code Here

  private MethodParameter resolveWriteMethodParameter() {
    if (getWriteMethod() == null) {
      return null;
    }
    return resolveParameterType(new MethodParameter(getWriteMethod(), 0));
  }
View Full Code Here

          arguments = new Object[paramTypes.length];
          DependencyDescriptor[] descriptors = new DependencyDescriptor[paramTypes.length];
          Set<String> autowiredBeanNames = new LinkedHashSet<String>(paramTypes.length);
          TypeConverter typeConverter = beanFactory.getTypeConverter();
          for (int i = 0; i < arguments.length; i++) {
            MethodParameter methodParam = new MethodParameter(method, i);
            GenericTypeResolver.resolveParameterType(methodParam, bean.getClass());
            descriptors[i] = new DependencyDescriptor(methodParam, this.required);
            arguments[i] = beanFactory.resolveDependency(
                descriptors[i], beanName, autowiredBeanNames, typeConverter);
            if (arguments[i] == null && !this.required) {
View Full Code Here

      // no qualification necessary
      return true;
    }
    boolean match = checkQualifiers(bdHolder, descriptor.getAnnotations());
    if (match) {
      MethodParameter methodParam = descriptor.getMethodParameter();
      if (methodParam != null) {
        Method method = methodParam.getMethod();
        if (method == null || void.class.equals(method.getReturnType())) {
          match = checkQualifiers(bdHolder, methodParam.getMethodAnnotations());
        }
      }
    }
    return match;
  }
View Full Code Here

   * @see Value
   */
  public Object getSuggestedValue(DependencyDescriptor descriptor) {
    Object value = findValue(descriptor.getAnnotations());
    if (value == null) {
      MethodParameter methodParam = descriptor.getMethodParameter();
      if (methodParam != null) {
        value = findValue(methodParam.getMethodAnnotations());
      }
    }
    return value;
  }
View Full Code Here

      Object... providedArgs) throws Exception {

    MethodParameter[] parameters = getMethodParameters();
    Object[] args = new Object[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      MethodParameter parameter = parameters[i];
      parameter.initParameterNameDiscovery(parameterNameDiscoverer);
      GenericTypeResolver.resolveParameterType(parameter, getBean().getClass());

      args[i] = resolveProvidedArgument(parameter, providedArgs);
      if (args[i] != null) {
        continue;
View Full Code Here

    }
    return args;
  }

  private String getArgumentResolutionErrorMessage(String message, int index) {
    MethodParameter param = getMethodParameters()[index];
    message += " [" + index + "] [type=" + param.getParameterType().getName() + "]";
    return getDetailedErrorMessage(message);
  }
View Full Code Here

      try {
        PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
        // Don't try autowiring by type for type Object: never makes sense,
        // even if it technically is a unsatisfied, non-simple property.
        if (!Object.class.equals(pd.getPropertyType())) {
          MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
          // Do not allow eager init for type matching in case of a prioritized post-processor.
          boolean eager = !PriorityOrdered.class.isAssignableFrom(bw.getWrappedClass());
          DependencyDescriptor desc = new AutowireByTypeDependencyDescriptor(methodParam, eager);
          Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);
          if (autowiredArgument != null) {
View Full Code Here

    return GenericCollectionTypeResolver.getMapValueParameterType(this.methodParameter);
  }

  @Override
  protected AbstractDescriptor nested(Class<?> type, int typeIndex) {
    MethodParameter methodParameter = new MethodParameter(this.methodParameter);
    methodParameter.increaseNestingLevel();
    methodParameter.setTypeIndexForCurrentLevel(typeIndex);
    return new ParameterDescriptor(type, methodParameter);
  }
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.