package org.supercsv.cellprocessor;

import java.util.Map;

import org.supercsv.cellprocessor.ift.BoolCellProcessor;
import org.supercsv.cellprocessor.ift.DateCellProcessor;
import org.supercsv.cellprocessor.ift.DoubleCellProcessor;
import org.supercsv.cellprocessor.ift.LongCellProcessor;
import org.supercsv.cellprocessor.ift.StringCellProcessor;
import org.supercsv.exception.NullInputException;
import org.supercsv.exception.SuperCSVException;
import org.supercsv.util.CSVContext;

/**
 * Translate a value into another one, given some value mapping.
 * 
 * @since 1.50
 * @author Dominique De Vito
 */
public class HashMapper extends CellProcessorAdaptor implements BoolCellProcessor, DateCellProcessor,
	DoubleCellProcessor, LongCellProcessor, StringCellProcessor {

private final Map<Object, Object> mapping;
private final Object defaultValue;

public HashMapper(final Map<Object, Object> mapping, final BoolCellProcessor next) {
	this(mapping, null, next);
}

public HashMapper(final Map<Object, Object> mapping, final Object defaultValue, final BoolCellProcessor next) {
	super(next);
	this.mapping = mapping;
	this.defaultValue = defaultValue;
	if( mapping == null ) { throw new NullInputException("Mapping cannot be null", this); }
}

/**
 * {@inheritDoc}
 */
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
	if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
		+ " at column " + context.columnNumber, context, this); }
	Object result = mapping.get(value);
	if( result == null ) {
		result = defaultValue;
	}
	return next.execute(result, context);
}
}

@@ -866,24 +866,311 @@
 ltValue;%0D%0A%0D%0A
+public HashMapper(final Map%3CObject, Object%3E mapping) %7B%0D%0A%09super();%0D%0A%09this.mapping = mapping;%0D%0A%09this.defaultValue = null;%0D%0A%7D%0D%0A%0D%0Apublic HashMapper(final Map%3CObject, Object%3E mapping, final Object defaultValue) %7B%0D%0A%09super();%0D%0A%09this.mapping = mapping;%0D%0A%09this.defaultValue = defaultValue;%0D%0A%7D%0D%0A%0D%0A
 public HashM

add of new constructors in case of no next processor