Package com.googlecode.objectify.impl.translate

Examples of com.googlecode.objectify.impl.translate.CreateContext


      // Special case entity pojos that become keys
      if (value.getClass().isAnnotationPresent(Entity.class)) {
        return factory().keys().getMetadataSafe(value).getRawKey(value);
      } else {
        // Run it through a translator
        Translator<Object, Object> translator = factory().getTranslators().get(new TypeKey<>(value.getClass()), new CreateContext(factory()), Path.root());
        return translator.save(value, false, new SaveContext(), Path.root());
      }
    }
  }
View Full Code Here


  /**
   */
  @Test
  public void simplePojoEntityTranslates() throws Exception {
    CreateContext createCtx = new CreateContext(fact());
    ClassTranslator<SimpleEntityPOJO> translator = ClassTranslatorFactory.createEntityClassTranslator(SimpleEntityPOJO.class, createCtx, Path.root());

    SimpleEntityPOJO pojo = new SimpleEntityPOJO();
    pojo.id = 123L;
    pojo.foo = "bar";
View Full Code Here

   */
  @Test
  public void simplePOJOTranslates() throws Exception {
    Path thingPath = Path.root().extend("somewhere");

    CreateContext createCtx = new CreateContext(fact());
    ClassTranslator<Thing> translator = ClassTranslatorFactory.createEmbeddedClassTranslator(Thing.class, createCtx, thingPath);

    Thing thing = new Thing();
    thing.foo = "bar";

View Full Code Here

TOP

Related Classes of com.googlecode.objectify.impl.translate.CreateContext

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.