Class CollectionTranslatorFactory

  • All Implemented Interfaces:
    TranslatorFactory<Collection<Object>,​List<? extends com.google.cloud.datastore.Value<?>>>

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

    Translator which can load things into a collection field. Those things are themselves translated.

    This translator is clever about recycling an existing collection in the POJO field when loading. That way a collection that has been initialized with a sort (or other data) will remain intact.

    Note that empty or null collections are not stored in the datastore, and null values for the collection 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 collection contents.

    Author:
    Jeff Schnitzer
    • Constructor Detail

      • CollectionTranslatorFactory

        public CollectionTranslatorFactory()