
package de.ivu.elect.exchange.csv.converter;

import static org.apache.commons.lang3.StringUtils.trimToEmpty;

import org.jsefa.common.converter.SimpleTypeConverter;
import org.jsefa.common.converter.SimpleTypeConverterConfiguration;

public abstract class AbstractElectCsvNumberConverter implements SimpleTypeConverter {

  private final SimpleTypeConverter numberConverter;

  protected AbstractElectCsvNumberConverter(SimpleTypeConverterConfiguration configuration, SimpleTypeConverter numberConverter) {
    super();

    this.numberConverter = numberConverter;
  }

  @Override
  public String toString(Object value) {
    return numberConverter.toString(value);
  }

  @Override
  public Object fromString(String value) {
    return numberConverter.fromString(trimToEmpty(value)); // ELECTMUC-2360
  }
}
