Package com.thoughtworks.paranamer

Examples of com.thoughtworks.paranamer.BytecodeReadingParanamer


* </ul>
*/
public class ParanamerConfiguration extends MostUsefulConfiguration {

    public ParanamerConfiguration() {
        useParanamer(new CachingParanamer(new BytecodeReadingParanamer()));
    }
View Full Code Here


    @Ignore("fails as perhaps Paranamer not peer of @named in respect of @composite")
    public void shouldMatchCompositeStepsAndCreateComposedStepsUsingParanamerNamedParameters() {
        CompositeStepsWithoutNamedAnnotation steps = new CompositeStepsWithoutNamedAnnotation();
        List<StepCandidate> candidates = steps.listCandidates();
        StepCandidate candidate = candidates.get(0);
        candidate.useParanamer(new BytecodeReadingParanamer());
        assertThat(candidate.isComposite(), is(true));
        Map<String, String> namedParameters = new HashMap<String, String>();
        namedParameters.put("customer", "Mr Jones");
        namedParameters.put("product", "ticket");
        List<Step> composedSteps = new ArrayList<Step>();
View Full Code Here

    @Test
    public void shouldInvokeBeforeOrAfterStepMethodWithMetaUsingParanamer() throws Exception {
        // Given
        SomeSteps stepsInstance = new SomeSteps();
        StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
        stepCreator.useParanamer(new CachingParanamer(new BytecodeReadingParanamer()));
        Properties properties = new Properties();
        properties.put("theme", "shopping cart");

        // When
        Step stepWithMeta = stepCreator.createBeforeOrAfterStep(SomeSteps.methodFor("aMethodWithoutNamedAnnotation"),
View Full Code Here

    @Test
    public void shouldInvokeBeforeOrAfterStepMethodWithExpectedConvertedParametersFromMeta() throws Exception {
        // Given
        SomeSteps stepsInstance = new SomeSteps();
        StepCreator stepCreator = stepCreatorUsing(stepsInstance, mock(StepMatcher.class), new ParameterControls());
        stepCreator.useParanamer(new CachingParanamer(new BytecodeReadingParanamer()));

        // When
        Date aDate = new Date();
        when(parameterConverters.convert(anyString(), eq(Date.class))).thenReturn(aDate);
        Step stepWithMeta = stepCreator.createBeforeOrAfterStep(SomeSteps.methodFor("aMethodWithDate"), new Meta());
View Full Code Here

  @SuppressWarnings("unchecked")
  public static String getParameterInfo(Member member) {
    Class parameters[] ;
    String[] paramnames;
    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);
    }
    if (parameters.length > 0) {
      if (paramnames==null || paramnames.length ==0 ) {
        paramnames = createDefaultParamNames(parameters.length);
      }
View Full Code Here

     *         RequestBody, this method will return a list of AnnotatedParameter
     *         objects based on the values of the parameter annotations
     */
    public static List<AnnotatedParameter> getAnnotatedParameters(Method method) {
        List<AnnotatedParameter> annotatedParameters = new ArrayList<>();
        Paranamer paranamer = new BytecodeReadingParanamer();
        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

     * default <code>BytecodeReadingParanamer</code>
     */
    protected final Paranamer _paranamer;

    public ParanamerModule() {
        this(new CachingParanamer(new BytecodeReadingParanamer()));
    }
View Full Code Here

    private static final long serialVersionUID = 1;

    protected final Paranamer _paranamer;

    public ParanamerOnJacksonAnnotationIntrospector() {
        this(new CachingParanamer(new BytecodeReadingParanamer()));
    }
View Full Code Here

    private static final long serialVersionUID = 1;

    protected final Paranamer _paranamer;

    public ParanamerOnJacksonAnnotationIntrospector() {
        this(new CachingParanamer(new BytecodeReadingParanamer()));
    }
View Full Code Here

    private static final long serialVersionUID = 1;

    protected final Paranamer _paranamer;

    public ParanamerOnJacksonAnnotationIntrospector() {
        this(new CachingParanamer(new BytecodeReadingParanamer()));
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.paranamer.BytecodeReadingParanamer

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.