Interface Populator<P>

  • All Known Implementing Classes:
    ClassPopulator, KeyPopulator, NullPopulator, PropertyPopulator

    public interface Populator<P>

    A populator knows how to copy properties between POJO objects and the native datastore representation. Unlike a translator, it doesn't create the POJO or container.

    P is the pojo type.

    Author:
    Jeff Schnitzer
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void load​(com.google.cloud.datastore.FullEntity<?> node, LoadContext ctx, Path path, P into)
      Loads the content of the specified datastore node into an existing POJO.
      void save​(P pojo, boolean index, SaveContext ctx, Path path, com.google.cloud.datastore.FullEntity.Builder<?> into)
      Saves data from the POJO into the entity builder.
    • Method Detail

      • load

        void load​(com.google.cloud.datastore.FullEntity<?> node,
                  LoadContext ctx,
                  Path path,
                  P into)

        Loads the content of the specified datastore node into an existing POJO.

        Parameters:
        node - is the part of the native datastore entity tree we are transforming.
        ctx - holds state information during an entity load.
        path - is the current path to this POJO
      • save

        void save​(P pojo,
                  boolean index,
                  SaveContext ctx,
                  Path path,
                  com.google.cloud.datastore.FullEntity.Builder<?> into)
        Saves data from the POJO into the entity builder.
        Parameters:
        pojo - is an object from the pojo entity graph; possibly the whole graph or possibly just a leaf field.
        index - is whether the instruction so far is to index or not index property values
        path - is the path that we have taken to get here, which could be long due to re-entrant translators (ie, an embedded pojo that also has a reference to the same class).