Package org.springframework.core

Examples of org.springframework.core.MethodParameter


    Map<String, PropertyDescriptor> properties = unsatisfiedNonSimpleProperties(mbd);
    for (Map.Entry<String, PropertyDescriptor> entry : properties.entrySet()) {
      String propertyName = entry.getKey();
      PropertyDescriptor pd = entry.getValue();
      if (Object.class.equals(pd.getPropertyType())) continue;
      MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
      List<String> beanNames = bindRegistry.getBeanNames(methodParam.getParameterType());
      boolean binded = false;
      if (beanNames.size() == 1) {
        mbd.getPropertyValues().add(propertyName, new RuntimeBeanReference(beanNames.get(0)));
        binded = true;
      } else if (beanNames.size() > 1) {
View Full Code Here


    Context context = Context.getCurrentContext();
    Map<String, Object> data = (Map<String, Object>) context.getParams().get("data");
    Class<?>[] parameterTypes = method.getParameterTypes();
    MethodParameter[] parameters = new MethodParameter[parameterTypes.length];
    for (int i = 0; i < parameterTypes.length; i++) {
      parameters[i] = new MethodParameter(method, i);
      parameters[i].initParameterNameDiscovery(parameterNameDiscoverer);
    }
    Object[] args = new Object[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      String name = parameters[i].getParameterName();
View Full Code Here

  }

  @Test
  public void doesNotSupportNonPageable() {

    MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "unsupportedMethod", String.class);
    assertThat(getResolver().supportsParameter(parameter), is(false));
  }
View Full Code Here

  }

  @Test
  public void rejectsInvalidQulifiers() throws Exception {

    MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "invalidQualifiers",
        Pageable.class, Pageable.class);

    HandlerMethodArgumentResolver resolver = getResolver();
    assertThat(resolver.supportsParameter(parameter), is(true));
View Full Code Here

  }

  @Test
  public void rejectsNoQualifiers() throws Exception {

    MethodParameter parameter = TestUtils.getParameterOfMethod(getControllerClass(), "noQualifiers", Pageable.class,
        Pageable.class);

    HandlerMethodArgumentResolver resolver = getResolver();
    assertThat(resolver.supportsParameter(parameter), is(true));
View Full Code Here

   */
  @Test
  public void createsPlainAssemblerWithoutContext() throws Exception {

    Method method = Controller.class.getMethod("noContext", PagedResourcesAssembler.class);
    Object result = resolver.resolveArgument(new MethodParameter(method, 0), null, null, null);

    assertThat(result, is(instanceOf(PagedResourcesAssembler.class)));
    assertThat(result, is(not(instanceOf(MethodParameterAwarePagedResourcesAssembler.class))));
  }
View Full Code Here

   */
  @Test
  public void doesNotFailForTemplatedMethodMapping() throws Exception {

    Method method = Controller.class.getMethod("methodWithPathVariable", PagedResourcesAssembler.class);
    Object result = resolver.resolveArgument(new MethodParameter(method, 0), null, null, null);

    assertThat(result, is(notNullValue()));
  }
View Full Code Here

    Method method = Controller.class.getMethod("methodWithMapping", PagedResourcesAssembler.class);

    // Simulate HandlerMethod.HandlerMethodParameter.getDeclaringClass()
    // as it's returning the invoked class as the declared one
    MethodParameter methodParameter = new MethodParameter(method, 0) {
      public java.lang.Class<?> getDeclaringClass() {
        return SubController.class;
      }
    };
View Full Code Here

    assertThat(uriComponents.getPath(), is("/foo/mapping"));
  }

  private void assertSelectsParameter(Method method, int expectedIndex) throws Exception {

    MethodParameter parameter = new MethodParameter(method, 0);

    Object result = resolver.resolveArgument(parameter, null, null, null);
    assertMethodParameterAwarePagedResourcesAssemblerFor(result, new MethodParameter(method, expectedIndex));
  }
View Full Code Here

    Method method = Controller.class.getMethod(methodName, PagedResourcesAssembler.class, Pageable.class,
        Pageable.class);

    exception.expect(IllegalStateException.class);
    resolver.resolveArgument(new MethodParameter(method, 0), null, null, null);
  }
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.