package me.chyxion.tigon.webmvc.formatter;

import java.util.Locale;
import org.springframework.format.Formatter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Jun 18, 2017 23:34:48
 */
public class TrimFormatter implements Formatter<String> {

    /**
     * {@inheritDoc}
     */
    @Override
    public String print(String text, Locale locale) {
        return text;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String parse(String text, Locale locale) {
        return StringUtils.trim(text);
    }
}
