Class ProjectionSafeTranslator<P,​D>

java.lang.Object
com.googlecode.objectify.impl.translate.NullSafeTranslator<P,​D>
com.googlecode.objectify.impl.translate.ProjectionSafeTranslator<P,​D>
All Implemented Interfaces:
Translator<P,​D>
Direct Known Subclasses:
ValueTranslator

public abstract class ProjectionSafeTranslator<P,​D>
extends NullSafeTranslator<P,​D>

Watches out for RawValue and performs the necessary conversion if we get one. This will happen during projection queries.

Author:
Jeff Schnitzer
  • Constructor Details

    • ProjectionSafeTranslator

      public ProjectionSafeTranslator(Class<? extends D> projectionClass)
  • Method Details

    • loadSafe

      protected final P loadSafe(D value, LoadContext ctx, Path path) throws SkipException
      Description copied from class: NullSafeTranslator
      Implement this, returning a proper translated value
      Specified by:
      loadSafe in class NullSafeTranslator<P,​D>
      Parameters:
      value - will never be null
      Throws:
      SkipException
    • loadSafe2

      protected abstract P loadSafe2(D value, LoadContext ctx, Path path) throws SkipException
      Decode from a property value as stored in the datastore to a type that will be stored in a pojo.
      Parameters:
      value - will not be null and will not be RawValue
      Returns:
      the format which should be stored in the pojo; a null means store a literal null!
      Throws:
      SkipException - if this field subtree should be skipped