Package org.springframework.core

Examples of org.springframework.core.LocalVariableTableParameterNameDiscoverer$LocalVariableTableVisitor


            } catch (Exception e) {
                logger.warn(
                        "Could not use "
                                + DEFAULT_PARAMETER_NAME_DISCOVERER_CLASSNAME
                                + ". Falling back to LocalVariableTableParameterNameDiscoverer.", e);
                addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
            }
        } else {
            addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
        }
    }
View Full Code Here


    @Test
    public void constructorDiscoverers() {
        Assume.assumeTrue(SpringVersion.getVersion().startsWith("3."));

        discoverer = new DefaultSecurityParameterNameDiscoverer(Arrays.asList(new LocalVariableTableParameterNameDiscoverer()));

        List<ParameterNameDiscoverer> discoverers = (List<ParameterNameDiscoverer>) ReflectionTestUtils
                .getField(discoverer, "parameterNameDiscoverers");

        assertThat(discoverers.size()).isEqualTo(3);
View Full Code Here

    @Test
    public void constructorDiscoverersSpring4() {
        Assume.assumeTrue(SpringVersion.getVersion().startsWith("4."));

        discoverer = new DefaultSecurityParameterNameDiscoverer(Arrays.asList(new LocalVariableTableParameterNameDiscoverer()));

        List<ParameterNameDiscoverer> discoverers = (List<ParameterNameDiscoverer>) ReflectionTestUtils
                .getField(discoverer, "parameterNameDiscoverers");

        assertThat(discoverers.size()).isEqualTo(3);
View Full Code Here

   */
  protected ParameterNameDiscoverer createParameterNameDiscoverer() {
    // We need to discover them, or if that fails, guess,
    // and if we can't guess with 100% accuracy, fail.
    PrioritizedParameterNameDiscoverer discoverer = new PrioritizedParameterNameDiscoverer();
    discoverer.addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
    AspectJAdviceParameterNameDiscoverer adviceParameterNameDiscoverer =
        new AspectJAdviceParameterNameDiscoverer(this.pointcut.getExpression());
    adviceParameterNameDiscoverer.setReturningName(this.returningName);
    adviceParameterNameDiscoverer.setThrowingName(this.throwingName);
    // Last in chain, so if we're called and we fail, that's bad...
View Full Code Here

   */
  protected ParameterNameDiscoverer createParameterNameDiscoverer() {
    // We need to discover them, or if that fails, guess,
    // and if we can't guess with 100% accuracy, fail.
    PrioritizedParameterNameDiscoverer discoverer = new PrioritizedParameterNameDiscoverer();
    discoverer.addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
    AspectJAdviceParameterNameDiscoverer adviceParameterNameDiscoverer =
        new AspectJAdviceParameterNameDiscoverer(this.pointcut.getExpression());
    adviceParameterNameDiscoverer.setReturningName(this.returningName);
    adviceParameterNameDiscoverer.setThrowingName(this.throwingName);
    // Last in chain, so if we're called and we fail, that's bad...
View Full Code Here

      return methodInvocation.getMethod().getParameterTypes();
    }

    public String[] getParameterNames() {
      if (this.parameterNames == null) {
        this.parameterNames = (new LocalVariableTableParameterNameDiscoverer()).getParameterNames(getMethod());
      }
      return this.parameterNames;
    }
View Full Code Here

  protected ParameterNameDiscoverer createParameterNameDiscoverer() {
    // We need to discover them, or if that fails, guess,
    // and if we can't guess with 100% accuracy, fail.
    PrioritizedParameterNameDiscoverer discoverer = new PrioritizedParameterNameDiscoverer();
    if (ASM_AVAILABLE) {
      discoverer.addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
    }
    AspectJAdviceParameterNameDiscoverer adviceParameterNameDiscoverer =
        new AspectJAdviceParameterNameDiscoverer(this.pointcut.getExpression());
    adviceParameterNameDiscoverer.setReturningName(this.returningName);
    adviceParameterNameDiscoverer.setThrowingName(this.throwingName);
View Full Code Here

    cavs2.addGenericArgumentValue(MARK);
    RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null);
    lbf.registerBeanDefinition(MARK, person2);
    MethodParameter param = new MethodParameter(QualifiedTestBean.class.getDeclaredConstructor(Person.class), 0);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(param, false);
    param.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
    assertEquals("tpb", param.getParameterName());
    assertTrue(lbf.isAutowireCandidate(JUERGEN, null));
    assertTrue(lbf.isAutowireCandidate(JUERGEN, qualifiedDescriptor));
    assertFalse(lbf.isAutowireCandidate(MARK, qualifiedDescriptor));
  }
View Full Code Here

        new MethodParameter(QualifiedTestBean.class.getDeclaredMethod("autowireQualified", Person.class), 0);
    MethodParameter nonqualifiedParam =
        new MethodParameter(QualifiedTestBean.class.getDeclaredMethod("autowireNonqualified", Person.class), 0);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(qualifiedParam, false);
    DependencyDescriptor nonqualifiedDescriptor = new DependencyDescriptor(nonqualifiedParam, false);
    qualifiedParam.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
    assertEquals("tpb", qualifiedParam.getParameterName());
    nonqualifiedParam.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
    assertEquals("tpb", nonqualifiedParam.getParameterName());
    assertTrue(lbf.isAutowireCandidate(JUERGEN, null));
    assertTrue(lbf.isAutowireCandidate(JUERGEN, nonqualifiedDescriptor));
    assertTrue(lbf.isAutowireCandidate(JUERGEN, qualifiedDescriptor));
    assertTrue(lbf.isAutowireCandidate(MARK, null));
View Full Code Here

    MethodParameter[] methodParameters = methodToResolve.getMethodParameters();
    if (resolvedMethod != null) {
      if (methodParameters.length == resolvedMethod.getArgumentCount()) {
        for (int index = 0; index < resolvedMethod.getArgumentCount(); index++) {
          MethodParameter methodParameter = methodParameters[index];
          methodParameter.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
          parameters.add(new ResolvedMethodParameter(methodParameter, resolvedMethod.getArgumentType(index)));
        }
      } else {
        log.warn(String.format("Problem trying to resolve a method named %s", methodToResolve.getMethod().getName()));
        log.warn(String.format("Method parameter count %s does not match resolved method argument count %s",
View Full Code Here

TOP

Related Classes of org.springframework.core.LocalVariableTableParameterNameDiscoverer$LocalVariableTableVisitor

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.