org.unix4j.convert.ConcatenatedConverter Maven / Gradle / Ivy
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