Class PropertyPopulator<P,D>

java.lang.Object
com.googlecode.objectify.impl.PropertyPopulator<P,D>
All Implemented Interfaces:
Populator<P>

public class PropertyPopulator<P,D> extends Object implements Populator<P>
Associates a Property with a Translator and provides a more convenient interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    com.google.cloud.datastore.Value<D>
    getValue(Object pojo, SaveContext ctx, Path containerPath)
    Get the value for the property and translate it into datastore format.
    void
    load(com.google.cloud.datastore.FullEntity<?> container, LoadContext ctx, Path containerPath, P intoPojo)
    Gets the appropriate value from the container and sets it on the appropriate field of the pojo.
    void
    save(P onPojo, boolean index, SaveContext ctx, Path containerPath, com.google.cloud.datastore.FullEntity.Builder<?> into)
    Gets the appropriate field value from the pojo and puts it in the container at the appropriate prop name and with the appropriate indexing.
    void
    setValue(Object pojo, com.google.cloud.datastore.Value<D> value, LoadContext ctx, Path containerPath)
    Set this raw datastore value on the relevant property of the pojo, doing whatever translations are necessary.
    This is easier to debug if we have a string value

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PropertyPopulator

      public PropertyPopulator()
  • Method Details

    • getLoadConditions

      public LoadConditions getLoadConditions()
    • toString

      public String toString()
      This is easier to debug if we have a string value
      Overrides:
      toString in class Object
    • load

      public void load(com.google.cloud.datastore.FullEntity<?> container, LoadContext ctx, Path containerPath, P intoPojo)
      Gets the appropriate value from the container and sets it on the appropriate field of the pojo.
      Specified by:
      load in interface Populator<P>
      Parameters:
      container - is the part of the native datastore entity tree we are transforming.
      ctx - holds state information during an entity load.
      containerPath - is the current path to this POJO
    • setValue

      public void setValue(Object pojo, com.google.cloud.datastore.Value<D> value, LoadContext ctx, Path containerPath) throws SkipException
      Set this raw datastore value on the relevant property of the pojo, doing whatever translations are necessary.
      Throws:
      SkipException
    • save

      public void save(P onPojo, boolean index, SaveContext ctx, Path containerPath, com.google.cloud.datastore.FullEntity.Builder<?> into)
      Gets the appropriate field value from the pojo and puts it in the container at the appropriate prop name and with the appropriate indexing.
      Specified by:
      save in interface Populator<P>
      Parameters:
      onPojo - is the parent pojo which holds the property we represent
      index - is the default state of indexing up to this point
      containerPath - is the path to the container; each property will extend this path.
    • getValue

      public com.google.cloud.datastore.Value<D> getValue(Object pojo, SaveContext ctx, Path containerPath)
      Get the value for the property and translate it into datastore format.