Class ArrayTranslatorFactory

java.lang.Object
com.googlecode.objectify.impl.translate.ArrayTranslatorFactory
All Implemented Interfaces:
TranslatorFactory<Object,List<? extends com.google.cloud.datastore.Value<?>>>

public class ArrayTranslatorFactory extends Object implements TranslatorFactory<Object,List<? extends com.google.cloud.datastore.Value<?>>>

Translator which can load an array of things.

Note that empty or null arrays are not stored in the datastore, and null values for the array field are ignored when they are loaded from the Entity. This is because the datastore doesn't store empty collections, and storing null fields will confuse filtering for actual nulls in the array contents.

The reason the generic P type of this factory is Object instead of Object[] is that Object[] is incompatible with the primitive arrays. This factory handles primitives as well.

Author:
Jeff Schnitzer invalid input: '<'[email protected]>
See Also:
  • Constructor Details

    • ArrayTranslatorFactory

      public ArrayTranslatorFactory()
  • Method Details

    • create

      public Translator<Object,List<? extends com.google.cloud.datastore.Value<?>>> create(TypeKey<Object> tk, CreateContext ctx, Path path)
      Description copied from interface: TranslatorFactory
      Create a translator for a type.
      Specified by:
      create in interface TranslatorFactory<Object,List<? extends com.google.cloud.datastore.Value<?>>>
      Parameters:
      tk - defines the type which is to be translated
      path - is where this type was discovered, important for logging and exceptions
      Returns:
      null if this factory does not know how to deal with that situation.