IsEmptyConfig.java

  1. package com.gh.mygreen.xlsmapper.util;



  2. /**
  3.  * {@link IsEmptyBuilder}の設定を組み立てるクラス。
  4.  *
  5.  * @since 1.0
  6.  * @author T.TSUCHIE
  7.  *
  8.  */
  9. public class IsEmptyConfig {
  10.    
  11.     /**
  12.      * 数値の場合、0を空として扱うか。
  13.      */
  14.     private boolean zeroAsEmpty;
  15.    
  16.     /**
  17.      * 配列の場合、値も対象とするかどうか。
  18.      */
  19.     private boolean testArrayElement;
  20.    
  21.     /**
  22.      * Collectionの場合、値も対象とするかどうか。
  23.      */
  24.     private boolean testCollectionElement;
  25.    
  26.     /**
  27.      * Mapの場合、値も対象とするかどうか。
  28.      */
  29.     private boolean testMapValue;
  30.    
  31.     /**
  32.      * ransientが付与されたフィールドも対象とするかどうか。
  33.      */
  34.     private boolean testTransient;
  35.    
  36.     /**
  37.      * インスタンスを作成する。
  38.      * @return
  39.      */
  40.     public static IsEmptyConfig create() {
  41.         return new IsEmptyConfig();
  42.     }
  43.    
  44.     /**
  45.      * コンストラクタ
  46.      */
  47.     public IsEmptyConfig() {
  48.        
  49.         this.zeroAsEmpty = true;
  50.         this.testArrayElement = true;
  51.         this.testCollectionElement = true;
  52.         this.testMapValue = true;
  53.         this.testTransient = false;
  54.     }
  55.    
  56.     /**
  57.      * 数値の0を空として扱うかどうか。
  58.      * @return true:0を空として扱う。初期値はtrueです。
  59.      */
  60.     public boolean isZeroAsEmpty() {
  61.         return zeroAsEmpty;
  62.     }
  63.    
  64.     /**
  65.      * 数値の0を空として扱うかどうか設定します。
  66.      * @param zeroAsEmpty 数値の0を空として扱うかどうか。
  67.      * @return 自身のインスタンス
  68.      */
  69.     public IsEmptyConfig withZeroAsEmpty(boolean zeroAsEmpty) {
  70.         this.zeroAsEmpty = zeroAsEmpty;
  71.         return this;
  72.        
  73.     }
  74.    
  75.     /**
  76.      * 配列の値も検証対象とするかどうか。
  77.      * @return true:配列の値も検証対象とする。初期値はtrueです。
  78.      */
  79.     public boolean isTestArrayElement() {
  80.         return testArrayElement;
  81.     }
  82.    
  83.     /**
  84.      * 配列の値も検証対象とするかどうかを設定します設定します。
  85.      * @param testArrayElement 配列の値も検証対象とするかどうか
  86.      * @return 自身のインスタンス
  87.      */
  88.     public IsEmptyConfig withTestArrayElement(boolean testArrayElement) {
  89.         this.testArrayElement = testArrayElement;
  90.         return this;
  91.     }
  92.    
  93.     /**
  94.      * Collectionの値も検証対象とするかどうか。
  95.      * @return true:Collectionの値も検証対象とする。初期値はtrueです。
  96.      */
  97.     public boolean isTestCollectionElement() {
  98.         return testCollectionElement;
  99.     }
  100.    
  101.     /**
  102.      * Collectionの値も検証対象とするかどうかを設定します設定します。
  103.      * @param testCollectionElement Collectionの値も検証対象とするかどうか
  104.      * @return 自身のインスタンス
  105.      */
  106.     public IsEmptyConfig withTestCollectionElement(boolean testCollectionElement) {
  107.         this.testCollectionElement = testCollectionElement;
  108.         return this;
  109.     }
  110.    
  111.     /**
  112.      * Mapの値も検証対象とするかどうか。
  113.      * @return true:Mapの値も検証対象とする。初期値はtrueです。
  114.      */
  115.     public boolean isTestMapValue() {
  116.         return testMapValue;
  117.     }
  118.    
  119.     /**
  120.      * Mapの値も検証対象とするかどうかを設定します設定します。
  121.      * @param testMapValue Mapの値も検証対象とするかどうか
  122.      * @return 自身のインスタンス
  123.      */
  124.     public IsEmptyConfig withTestMapValue(boolean testMapValue) {
  125.         this.testMapValue = testMapValue;
  126.         return this;
  127.     }
  128.    
  129.     /**
  130.      * transientが付与されたフィールドも対象とするかどうか。
  131.      * @return true:場合テスト対象となります。初期値はfalseです。
  132.      */
  133.     public boolean isTestTransient() {
  134.         return testTransient;
  135.     }
  136.    
  137.     /**
  138.      * transientが付与されたフィールドも対象とするかどうか設定します。
  139.      * @param testTransient transientが付与されたフィールドも対象とするかどうか。
  140.      * @return 自身のインスタンス
  141.      */
  142.     public IsEmptyConfig withTestTransient(boolean testTransient) {
  143.         this.testTransient = testTransient;
  144.         return this;
  145.     }
  146.    
  147. }