Package com.vercer.engine.persist.translator

Examples of com.vercer.engine.persist.translator.ListTranslator


    parentTranslator = new ParentEntityTranslator(this);
    independantTranslator = new EntityTranslator(this);
    keyFieldTranslator = new KeyFieldTranslator(this, valueTranslatorChain, converter);
    childTranslator = new ChildEntityTranslator(this);
    embedTranslator = new ListTranslator(objectFieldTranslator);
    polyMorphicComponentTranslator = new ListTranslator(new MapTranslator(new PolymorphicTranslator(objectFieldTranslator, fieldStrategy), converter));
    defaultTranslator = new ListTranslator(new MapTranslator(new ChainedTranslator(valueTranslatorChain, getFallbackTranslator()), converter));

    keyCache = createKeyCache();
  }
View Full Code Here


  public void writeReadSimpleList() throws SecurityException, NoSuchFieldException
  {
    // create dummy translator that always returns a single property containing the instance
    PropertyTranslator chained = new DirectTranslator();

    ListTranslator translator = new ListTranslator(chained);
    Set<Property> encoded = translator.typesafeToProperties(values, Path.EMPTY_PATH, true);

    // should be a single property with a list of values
    assertEquals(1, encoded.size());

    Field field = getClass().getDeclaredField("values");

    @SuppressWarnings("unchecked")
    List<String> decoded = (List<String>) translator.propertiesToTypesafe(encoded, Path.EMPTY_PATH, field.getGenericType());

    assertEquals("is", decoded.get(1));
    assertEquals(3, decoded.size());
  }
View Full Code Here

      {
        return properties.iterator().next().getValue();
      }
    };

    ListTranslator translator = new ListTranslator(chained);
    Set<Property> encoded = translator.typesafeToProperties(values, Path.EMPTY_PATH, true);

    assertEquals(2, encoded.size());
    assertEquals(3, ((List<?>) encoded.iterator().next().getValue()).size());
    assertEquals(1, encoded.iterator().next().getPath().getParts().size());

    Field field = getClass().getDeclaredField("values");

    @SuppressWarnings("unchecked")
    List<String> decoded = (List<String>) translator.propertiesToTypesafe(encoded, Path.EMPTY_PATH, field.getGenericType());

    assertEquals("is", decoded.get(1));
    assertEquals(3, decoded.size());
  }
View Full Code Here

TOP

Related Classes of com.vercer.engine.persist.translator.ListTranslator

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.