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

ch.lambdaj.function.convert.ArgumentConverter Maven / Gradle / Ivy

// Modified or written by Ex Machina SAGL for inclusion with lambdaj.
// Copyright (c) 2009 Mario Fusco, Luca Marrocco.
// Licensed under the Apache License, Version 2.0 (the "License")

package ch.lambdaj.function.convert;

import static ch.lambdaj.function.argument.ArgumentsFactory.*;
import ch.lambdaj.function.argument.*;

/**
 * Converts an object in the value returned by the evaluation of the given argument on it.
 * @author Mario Fusco
 */
public class ArgumentConverter implements Converter {

	private final Argument argument;
	
	public ArgumentConverter(Argument argument) {
		this.argument = argument;
	}
	
	public ArgumentConverter(T argument) {
		this(actualArgument(argument));
	}
	
	public T convert(F from) {
		return argument.evaluate(from);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy