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

org.srplib.conversion.ChainConverter Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package org.srplib.conversion;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.srplib.contract.Argument;

/**
 * Converter chain converter.
 *
 * 

Sequentially invokes aggregated converters.

* * @author Anton Pechinsky */ public class ChainConverter implements Converter { private List converters = new ArrayList(); public ChainConverter(List converters) { Argument.checkNotNull(converters, "Converters list should not be null."); this.converters = converters; } public ChainConverter(Converter... converters) { this(Arrays.asList(converters)); } @Override @SuppressWarnings("unchecked") public O convert(I input) { Object value = input; for (Converter converter : converters) { value = converter.convert(value); } return (O) value; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy