![JAR search and dependency download from the Maven repository](/logo.png)
com.github.mygreen.supercsv.annotation.constraint.CsvEquals Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of super-csv-annotation Show documentation
Show all versions of super-csv-annotation Show documentation
CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。
package com.github.mygreen.supercsv.annotation.constraint;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Collection;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.DefaultGroup;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.cellprocessor.constraint.EqualedValueProvider;
import com.github.mygreen.supercsv.cellprocessor.format.TextPrinter;
/**
* カラムの値が指定した値と等しいかどうかチェックします。
*
* @since 2.0
* @author T.TSUCHIE
*
*/
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(CsvEquals.List.class)
@CsvConstraint(value={})
public @interface CsvEquals {
/**
* 比較する値を指定します。
* {@literal {key}}の書式の場合、プロパティファイルから取得した値を指定できます。
* @return ブール型、数値や日時型の場合は、アノテーションで指定した書式に沿った値を指定する必要があります。
*/
String[] value() default {};
/**
* 値を取得するプロバイダクラスを指定します。
* @return {@link EqualedValueProvider}の実装クラスを指定します。
*/
@SuppressWarnings("rawtypes")
Class extends EqualedValueProvider> [] provider() default {};
/**
* エラー時のメッセージを指定します。
* {@literal {key}}の書式の場合、プロパティファイルから取得した値を指定できます。
*
* 使用可能なメッセージ中の変数は下記の通りです。
*
* - lineNumber : カラムの値に改行が含まれている場合を考慮した実際の行番号です。1から始まります。
* - rowNumber : CSVの行番号です。1から始まります。
* - columnNumber : CSVの列番号です。1から始まります。
* - label : カラムの見出し名です。
* - validatedValue : 実際のカラムの値です。
* - equalsValues : アノテーションの属性{@link #value()}をフィールドの型に変換した値です。{@link Collection}の形式です。
* - formatter : カラムの値に対数するフォーマッタです。{@link TextPrinter#print(Object)}でvalidatedValue, equalsValuesの値を文字列に変換します。
*
*
* @return 省略した場合は、適用された{@link CellProcessor}に基づいたメッセージが出力されます。
*/
String message() default "{com.github.mygreen.supercsv.annotation.constraint.CsvEquals.message}";
/**
* 適用するケースを指定します。
* @return 何も指定しない場合は全てのケースに適用されます。
*/
BuildCase[] cases() default {};
/**
* グループのクラスを指定します。
* 処理ごとに適用するアノテーションを切り替えたい場合に指定します。
* @return 指定しない場合は、{@link DefaultGroup}が適用され全ての処理に適用されます。
*/
Class>[] groups() default {};
/**
* アノテーションの処理順序の定義。
* @return 値が大きいほど後に実行されます。
* 値が同じ場合は、アノテーションのクラス名の昇順になります。
*/
int order() default 0;
/**
* アノテーションを複数個指定する際の要素です。
*/
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@interface List {
CsvEquals[] value();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy