Class SaverImpl

  • All Implemented Interfaces:
    Saver

    public class SaverImpl
    extends Object
    implements Saver
    Implementation of the Put interface.
    Author:
    Jeff Schnitzer
    • Method Detail

      • entity

        public <E> Result<Key<E>> entity​(E entity)
        Description copied from interface: Saver

        Asynchronously save a single entity in the datastore.

        If the entity has a null Long id, the value will be autogenerated and populated on the entity object when the async operation completes. If you require this value, call now() on the result.

        Puts do not cascade.

        Specified by:
        entity in interface Saver
        Parameters:
        entity - must be a registered entity type
        Returns:
        an asynchronous result. To force a synchronous save, call Result.now().
      • entities

        public <E> Result<Map<Key<E>,​E>> entities​(E... entities)
        Description copied from interface: Saver
        A convenience method for entities(Iterable)
        Specified by:
        entities in interface Saver
      • entities

        public <E> Result<Map<Key<E>,​E>> entities​(Iterable<E> entities)
        Description copied from interface: Saver

        Asynchronously save a batch of entities in the datastore.

        If any entities have null Long ids, the values will be autogenerated and populated on the entity objects when the async operation completes. If you require these values, call now() on the result.

        Puts do not cascade.

        Specified by:
        entities in interface Saver
        Parameters:
        entities - must be registered entity types
        Returns:
        an asynchronous result. To force a synchronous save, call Result.now().
      • toEntity

        public com.google.appengine.api.datastore.Entity toEntity​(Object pojo)
        Description copied from interface: Saver
        Convert a POJO object to a native datastore Entity. This is like a save() operation but without actually saving the data to the datastore.
        Specified by:
        toEntity in interface Saver
        Parameters:
        pojo - must be an instance of a registered pojo entity type.
        Returns:
        the native datastore Entity equivalent of the pojo; exactly what Objectify would save if you saved the POJO normally.