![JAR search and dependency download from the Maven repository](/logo.png)
org.supercsv.ext.cellprocessor.ift.ValidationCellProcessor Maven / Gradle / Ivy
Show all versions of super-csv-annotation Show documentation
package org.supercsv.ext.cellprocessor.ift;
import java.util.Map;
/**
* Validation系のCellProcessor.
* エラー時のメッセージ出力する場合に、このインタフェースを実装する。
*
* @author T.TSUCHIE
*
*/
public interface ValidationCellProcessor {
/**
* メッセージのコードを取得する。
* 基本は、{@literal + ".violated"}
* 例. org.supercsv.contrib.cellprocessor.constraint.StrMax.violated
* @return
*/
default String getMessageCode() {
return this.getClass().getCanonicalName() + ".violated";
}
/**
* メッセージ用の変数を取得する。
*
Map.key = message variable key
*
Map.value = message variable value
*
ex.{@literal CellProcessor:NumberRange, Map.key = max, Map.vale = 5.}
* @return
*/
Map getMessageVariable();
/**
* メッセージに埋め込む際の値を取得する。
* java.util.Date型の時など、表記とそぐわない場合があるため。
* @param value フォーマット対象の値。
* @return フォーマットした値。
*/
default String formatValue(final Object value) {
if(value == null) {
return "";
}
return value.toString();
}
}