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

org.javasimon.console.action.CsvStringifierFactory Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package org.javasimon.console.action;

import org.javasimon.console.text.BaseStringifier;
import org.javasimon.console.text.Stringifier;
import org.javasimon.console.text.StringifierFactory;

/**
 * Value formatter for CSV response format.
 *
 * @author gquintana
 */
public class CsvStringifierFactory extends StringifierFactory {

	@Override
	protected Stringifier registerStringStringifier(Stringifier nullStringifier) {
		Stringifier stringStringifier = new BaseStringifier(nullStringifier) {
			@Override
			protected String doToString(String s) {
				return "\"" + s.replace("\"", "\"\"") + "\"";
			}
		};
		compositeStringifier.add(String.class, stringStringifier);
		return stringStringifier;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy