All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.objectify.impl.ResultAdapter Maven / Gradle / Ivy

Go to download

*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore

The newest version!
package com.googlecode.objectify.impl;

import java.util.concurrent.Future;

import com.googlecode.objectify.Result;
import com.googlecode.objectify.util.FutureHelper;

/**
 * Adapts a Future object to a (much more convenient) Result object.
 * 
 * @author Jeff Schnitzer 
 */
public class ResultAdapter implements Result
{
	/** */
	Future future;
	
	/** */
	public ResultAdapter(Future fut)
	{
		this.future = fut;
	}

	@Override
	public T get()
	{
		try
		{
			return this.future.get();
		}
		catch (Exception e)
		{
			FutureHelper.unwrapAndThrow(e);
			return null;	// make compiler happy
		}
	}

	@Override
	public Future getFuture()
	{
		return this.future;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy