Package br.com.six2six.fixturefactory.transformer

Examples of br.com.six2six.fixturefactory.transformer.TransformerChain


   
    if (owner != null && ReflectionUtils.isInnerClass(templateHolder.getClazz()))  {
      values.add(owner)
    }
   
        TransformerChain transformerChain = buildTransformerChain(new ParameterPlaceholderTransformer(arguments));
   
    for (String parameterName : parameterNames) {
      Class<?> fieldType = ReflectionUtils.invokeRecursiveType(templateHolder.getClazz(), parameterName);
      Object result = arguments.get(parameterName);
      if (result == null) {
        result = processChainedProperty(parameterName, fieldType, arguments)
      }
      values.add(transformerChain.transform(result, fieldType));
    }
    return values;
  }
View Full Code Here


    if (property.hasRelationFunction() || ReflectionUtils.isInnerClass(fieldType)) {
        value = processor != null ? property.getValue(object, processor) : property.getValue(object);
    } else {
        value = property.getValue();
    }
      TransformerChain transformerChain = buildTransformerChain(new PropertyPlaceholderTransformer(object));
    return transformerChain.transform(value, fieldType);
  }
View Full Code Here

    Collection<String> propertyNames = ReflectionUtils.map(properties, "rootAttribute");
    return ReflectionUtils.filterConstructorParameters(target, propertyNames);
  }
 
  protected TransformerChain buildTransformerChain(Transformer transformer) {
      TransformerChain transformerChain = new TransformerChain(transformer);
     
      transformerChain.add(new CalendarTransformer());
        transformerChain.add(new SetTransformer());
        transformerChain.add(new PrimitiveTransformer());
        transformerChain.add(new WrapperTransformer());
       
        return transformerChain;
  }
View Full Code Here

   
    if (owner != null && ReflectionUtils.isInnerClass(templateHolder.getClazz()))  {
      values.add(owner)
    }
   
        TransformerChain transformerChain = buildTransformerChain(new ParameterPlaceholderTransformer(arguments));
   
    for (String parameterName : parameterNames) {
      Class<?> fieldType = ReflectionUtils.invokeRecursiveType(templateHolder.getClazz(), parameterName);
      Object result = arguments.get(parameterName);
      if (result == null) {
        result = processChainedProperty(parameterName, fieldType, arguments)
      }
      values.add(transformerChain.transform(result, fieldType));
    }
    return values;
  }
View Full Code Here

    if (property.hasRelationFunction() || ReflectionUtils.isInnerClass(fieldType)) {
        value = processor != null ? property.getValue(object, processor) : property.getValue(object);
    } else {
        value = property.getValue();
    }
      TransformerChain transformerChain = buildTransformerChain(new PropertyPlaceholderTransformer(object));
    return transformerChain.transform(value, fieldType);
  }
View Full Code Here

    Collection<String> propertyNames = ReflectionUtils.map(properties, "rootAttribute");
    return ReflectionUtils.filterConstructorParameters(target, propertyNames);
  }
 
  protected TransformerChain buildTransformerChain(Transformer transformer) {
      TransformerChain transformerChain = new TransformerChain(transformer);
     
      transformerChain.add(new CalendarTransformer());
        transformerChain.add(new SetTransformer());
        transformerChain.add(new PrimitiveTransformer());
        transformerChain.add(new WrapperTransformer());
       
        return transformerChain;
  }
View Full Code Here

public class TransformerChainTest {

    @Test
    public void shouldUseFirstTransformer() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        assertEquals("A1", transformerChain.transform("A", String.class));
    }
View Full Code Here

        assertEquals("A1", transformerChain.transform("A", String.class));
    }
   
    @Test
    public void shouldUseSecondTransformer() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("B2", transformerChain.transform("B", String.class));       
    }
View Full Code Here

        assertEquals("B2", transformerChain.transform("B", String.class));       
    }
   
    @Test
    public void shouldUseBothTransformersInOrderOfInclusion() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("AB12", transformerChain.transform("AB", String.class));       
    }
View Full Code Here

        assertEquals("AB12", transformerChain.transform("AB", String.class));       
    }
   
    @Test
    public void shouldNotUseAnyOfTheTransformers() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("C", transformerChain.transform("C", String.class));       
    }
View Full Code Here

TOP

Related Classes of br.com.six2six.fixturefactory.transformer.TransformerChain

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.