com.googlecode.objectify.impl.ResultAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objectify Show documentation
Show all versions of objectify Show documentation
The simplest convenient interface to the Google App Engine datastore
package com.googlecode.objectify.impl;
import com.googlecode.objectify.Result;
import com.googlecode.objectify.util.FutureHelper;
import java.util.concurrent.Future;
/**
* Adapts a Future object to a (much more convenient) Result object.
*
* @author Jeff Schnitzer
*/
public class ResultAdapter implements Result
{
/** Cuts out some typing */
public static ResultAdapter create(Future fut) {
return new ResultAdapter<>(fut);
}
/** */
Future future;
/** */
public ResultAdapter(Future fut)
{
this.future = fut;
}
@Override
public T now()
{
try
{
return this.future.get();
}
catch (Exception e)
{
FutureHelper.unwrapAndThrow(e);
return null; // make compiler happy
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy