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

org.unix4j.convert.ConcatenatedConverter Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package org.unix4j.convert;

public class ConcatenatedConverter implements ValueConverter {
	
	private final ValueConverter first;
	private final ValueConverter second;
	
	public ConcatenatedConverter(ValueConverter sourceConverter, ValueConverter targetConverter) {
		this.first = sourceConverter;
		this.second = targetConverter;
	}
	
	public static  ConcatenatedConverter concat(ValueConverter first, ValueConverter second) {
		return new ConcatenatedConverter(first, second);
	}
	public  ConcatenatedConverter concat(ValueConverter next) {
		return concat(this, next);
	}
	
	@Override
	public V convert(Object value) throws IllegalArgumentException {
		final Object source = first.convert(value);
		return second.convert(source);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy