Examples of lookupParameterNames()


Examples of com.thoughtworks.paranamer.AdaptiveParanamer.lookupParameterNames()

        Annotation[][] annotations = getActionMethod().getParameterAnnotations();
        Object[] parameters = new Object[types.length];

        if (types.length > 0){
            Paranamer paranamer = new AdaptiveParanamer();
            String[] names = paranamer.lookupParameterNames(getActionMethod());
            for(int i=0; i<parameters.length; i++){
                BindingContext ctx = new BindingContext();
                ctx.setParameterName(names[i]);
                ctx.setParameterType(types[i]);
                ctx.setRequest(getRequest());
View Full Code Here

Examples of com.thoughtworks.paranamer.AdaptiveParanamer.lookupParameterNames()

    public static <T> List<String> filterConstructorParameterNames(Class<T> target, Collection<String> names) {
    List<String> result = Collections.emptyList();
    Paranamer paranamer = new AdaptiveParanamer();
   
    for (Constructor<T> constructor : new Mirror().on(target).reflectAll().constructors()) {
      List<String> constructorParameterNames = Arrays.asList(paranamer.lookupParameterNames(constructor, false));
      if (result.size() < constructorParameterNames.size() && names.containsAll(constructorParameterNames)) {
        result = constructorParameterNames;
      }
    }
   
View Full Code Here

Examples of com.thoughtworks.paranamer.AdaptiveParanamer.lookupParameterNames()

    public static <T> List<String> filterConstructorParameters(Class<T> target, Collection<String> names) {
    List<String> result = Collections.emptyList();
    Paranamer paranamer = new AdaptiveParanamer();
   
    for (Constructor<T> constructor : new Mirror().on(target).reflectAll().constructors()) {
      List<String> constructorParameterNames = Arrays.asList(paranamer.lookupParameterNames(constructor, false));
      if (result.size() < constructorParameterNames.size()) {
        if (names.containsAll(constructorParameterNames)
            && constructorParameterTypesMatch(target, constructorParameterNames, Arrays.asList(constructor.getParameterTypes())))
          result = constructorParameterNames;
      }
View Full Code Here

Examples of com.thoughtworks.paranamer.AnnotationParanamer.lookupParameterNames()

    this.underlyingMethod = m;
    this.methodName = m.getName();
    this.returnType = m.getReturnType();
//    Paranamer para = new BytecodeReadingParanamer();
    Paranamer para = new AnnotationParanamer();
    String[] parameterNames = para.lookupParameterNames(m, true);
    if(parameterNames == null) throw new RuntimeException(String.format("Unable to read the parameter names for method %s.  This is likely due to the class files not including the appropriate debugging information.  Look up java -g for more information.", m));
    Class<?>[] types = m.getParameterTypes();
    if(parameterNames.length != types.length) throw new RuntimeException(String.format("Unexpected number of parameter names %s.  Expected %s on method %s.", Arrays.toString(parameterNames), Arrays.toString(types), m.toGenericString()));
    arguments = new CodeGeneratorArgument[parameterNames.length];
    for(int i =0 ; i < parameterNames.length; i++){
View Full Code Here

Examples of com.thoughtworks.paranamer.AnnotationParanamer.lookupParameterNames()

    this.underlyingMethod = m;
    this.methodName = m.getName();
    this.returnType = m.getReturnType();
//    Paranamer para = new BytecodeReadingParanamer();
    Paranamer para = new AnnotationParanamer();
    String[] parameterNames = para.lookupParameterNames(m, true);
    if (parameterNames == null) {
      throw new RuntimeException(String.format("Unable to read the parameter names for method %s.  This is likely due to the class files not including the appropriate debugging information.  Look up java -g for more information.", m));
    }
    Class<?>[] types = m.getParameterTypes();
    if (parameterNames.length != types.length) {
View Full Code Here

Examples of com.thoughtworks.paranamer.AnnotationParanamer.lookupParameterNames()

    this.underlyingMethod = m;
    this.methodName = m.getName();
    this.returnType = m.getReturnType();
//    Paranamer para = new BytecodeReadingParanamer();
    Paranamer para = new AnnotationParanamer();
    String[] parameterNames = para.lookupParameterNames(m, true);
    if(parameterNames == null) throw new RuntimeException(String.format("Unable to read the parameter names for method %s.  This is likely due to the class files not including the appropriate debugging information.  Look up java -g for more information.", m));
    Class<?>[] types = m.getParameterTypes();
    if(parameterNames.length != types.length) throw new RuntimeException(String.format("Unexpected number of parameter names %s.  Expected %s on method %s.", Arrays.toString(parameterNames), Arrays.toString(types), m.toGenericString()));
    arguments = new CodeGeneratorArgument[parameterNames.length];
    for(int i =0 ; i < parameterNames.length; i++){
View Full Code Here

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames()

    StringBuilder sb=new StringBuilder();
    Paranamer namer = new BytecodeReadingParanamer();
    if (member instanceof Method) {
      Method m = (Method) member;
      parameters = m.getParameterTypes();
      paramnames = namer.lookupParameterNames(m, false);
    } else {
      Constructor c = (Constructor) member;
      parameters = c.getParameterTypes();
      paramnames = namer.lookupParameterNames(c, false);
    }
View Full Code Here

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames()

      parameters = m.getParameterTypes();
      paramnames = namer.lookupParameterNames(m, false);
    } else {
      Constructor c = (Constructor) member;
      parameters = c.getParameterTypes();
      paramnames = namer.lookupParameterNames(c, false);
    }
    if (parameters.length > 0) {
      if (paramnames==null || paramnames.length ==0 ) {
        paramnames = createDefaultParamNames(parameters.length);
      }
View Full Code Here

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames()

        String[] parameterNames;
        //Attempt to use Paranamer to look up the parameter names for those not using Java 8+.
        //This will fail if trying to evaluate a class using Lambdas, in which case fall back and look up using
        //standard java reflections.  This will provide the paramter name if using the -parameters javac argument.
        try {
            parameterNames = paranamer.lookupParameterNames(method);
        } catch(Exception e) {
            Parameter[] parameters = method.getParameters();
            parameterNames = new String[parameters.length];
            for (int i = 0; i < parameters.length; i++) {
                Parameter parameter = parameters[i];
View Full Code Here

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames()

        //
        // Build Parameter Infos
        // Extract parameter names from debug symbols
        Paranamer paranamer = new BytecodeReadingParanamer();
        String[] parameterNames = paranamer.lookupParameterNames(concreteMethod);
        Class<?>[] types = concreteMethod.getParameterTypes();

        // Parameter annotations used form descriptor come from the annotated method, not the public method
        Annotation[][] parameterAnnotations;
        if (annotatedMethod != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.