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

net.sf.gluebooster.java.booster.basic.transformation.FunctionByCallable Maven / Gradle / Ivy

package net.sf.gluebooster.java.booster.basic.transformation;

import com.google.common.base.Function;

import net.sf.gluebooster.java.booster.essentials.eventsCommands.Callable;
import net.sf.gluebooster.java.booster.essentials.utils.ThrowableBoostUtils;

/**
 * Wraps a callable into a function
 * 
 * @author cbauer
 *
 * @param 
 * @param 
 */
public class FunctionByCallable implements Function {

	/**
	 * The delegate
	 */
	private Callable callable;

	private FunctionByCallable() {

	}

	public FunctionByCallable(Callable callable) {
		super();
		this.callable = callable;
	}

	@Override
	public Result apply(Param input) {
		try {
			return callable.call(input);
		} catch (Exception ex) {
			throw ThrowableBoostUtils.toRuntimeException(ex);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy