Package com.googlecode.objectify.impl

Source Code of com.googlecode.objectify.impl.ProjectionIterator

package com.googlecode.objectify.impl;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.QueryResultIterator;
import com.googlecode.objectify.impl.translate.LoadContext;
import com.googlecode.objectify.util.TranslatingQueryResultIterator;

import java.util.logging.Logger;

/**
* Projections bypass the session entirely, neither loading nor saving.
*/
public class ProjectionIterator<T> extends TranslatingQueryResultIterator<Entity, T> {
  /** */
  private static final Logger log = Logger.getLogger(ProjectionIterator.class.getName());

  private final LoadEngine loadEngine;
  private final LoadContext ctx;

  /** */
  public ProjectionIterator(QueryResultIterator<Entity> base, LoadEngine loadEngine) {
    super(base);
    this.loadEngine = loadEngine;
    this.ctx = new LoadContext(loadEngine);
  }

  @Override
  protected T translate(Entity from) {
    return loadEngine.load(from, ctx);
  }
}
TOP

Related Classes of com.googlecode.objectify.impl.ProjectionIterator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.