Package org.springframework.core

Examples of org.springframework.core.MethodParameter


    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 BeanPropertyDescriptor(type, this.property, methodParameter, this.annotations);
  }
View Full Code Here


    if (converter instanceof BeanWrapperImpl) {
      return ((BeanWrapperImpl) converter).convertForProperty(value, propertyName);
    }
    else {
      PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
      MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
      return converter.convertIfNecessary(value, pd.getPropertyType(), methodParam);
    }
  }
View Full Code Here

    if (invocationTarget == null || invocationTarget.member instanceof Method) {
      Method method = (Method) (invocationTarget==null?null:invocationTarget.member);
      if (method == null) {
        method = findGetterForProperty(name, type, target);
        if (method != null) {
          invocationTarget = new InvokerPair(method,new TypeDescriptor(new MethodParameter(method,-1)));
          ReflectionUtils.makeAccessible(method);
          this.readerCache.put(cacheKey, invocationTarget);
        }
      }
      if (method != null) {
View Full Code Here

      super(field, true);
      this.lookupType = lookupType;
    }

    public LookupDependencyDescriptor(Method method, Class<?> lookupType) {
      super(new MethodParameter(method, 0), true);
      this.lookupType = lookupType;
    }
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();
          args.resolveNecessary = true;
View Full Code Here

    BeanDefinitionValueResolver valueResolver =
        new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
    Object[] resolvedArgs = new Object[argsToResolve.length];
    for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
      Object argValue = argsToResolve[argIndex];
      MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex);
      GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass());
      if (argValue instanceof AutowiredArgumentMarker) {
        argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
      }
      else if (argValue instanceof BeanMetadataElement) {
View Full Code Here

        }
        if (method.getName().equals(name)) {
          Class<?>[] paramTypes = method.getParameterTypes();
          List<TypeDescriptor> paramDescriptors = new ArrayList<TypeDescriptor>(paramTypes.length);
          for (int i = 0; i < paramTypes.length; i++) {
            paramDescriptors.add(new TypeDescriptor(new MethodParameter(method, i)));
          }
          ReflectionHelper.ArgumentsMatchInfo matchInfo = null;
          if (method.isVarArgs() && argumentTypes.size() >= (paramTypes.length - 1)) {
            // *sigh* complicated
            matchInfo = ReflectionHelper.compareArgumentsVarargs(paramDescriptors, argumentTypes, typeConverter);
View Full Code Here

      for (int i = 0; i < varargsPosition; i++) {
        TypeDescriptor targetType = new TypeDescriptor(MethodParameter.forMethodOrConstructor(methodOrCtor, i));
        Object argument = arguments[i];
        arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);       
      }
      MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, varargsPosition);
      if (varargsPosition == arguments.length - 1) {
        TypeDescriptor targetType = new TypeDescriptor(methodParam);       
        Object argument = arguments[varargsPosition];
        arguments[varargsPosition] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);         
      } else {
View Full Code Here

      varargsPosition = paramTypes.length - 1;
    }
    for (int argPosition = 0; argPosition < arguments.length; argPosition++) {
      TypeDescriptor targetType;
      if (varargsPosition != null && argPosition >= varargsPosition) {
        MethodParameter methodParam = new MethodParameter(method, varargsPosition);
        targetType = TypeDescriptor.nested(methodParam, 1);
      }
      else {
        targetType = new TypeDescriptor(new MethodParameter(method, argPosition));
      }
      try {
        Object argument = arguments[argPosition];
        if (argument != null && !targetType.getObjectType().isInstance(argument)) {
          if (converter == null) {
View Full Code Here

    }

    try {
      ReflectionUtils.makeAccessible(method);
      Object result = method.invoke(method.getClass(), functionArgs);
      return new TypedValue(result, new TypeDescriptor(new MethodParameter(method,-1)).narrow(result));
    }
    catch (Exception ex) {
      throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.EXCEPTION_DURING_FUNCTION_CALL,
          this.name, ex.getMessage());
    }
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.