XlsHorizontalRecordsForIterateTables.java

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

  2. import java.lang.annotation.Annotation;

  3. import com.gh.mygreen.xlsmapper.fieldprocessor.ProcessCase;
  4. import com.gh.mygreen.xlsmapper.fieldprocessor.impl.HorizontalRecordsProcessor;
  5. import com.gh.mygreen.xlsmapper.fieldprocessor.impl.IterateTablesProcessor;


  6. /**
  7.  * {@link IterateTablesProcessor}から、{@link HorizontalRecordsProcessor}へ{@link XlsHorizontalRecords}の情報を渡す際のインタフェース用クラス。
  8.  * <p>アノテーションとしては直接には使用しない。</p>
  9.  * <p>{@link XlsIterateTables}により決定した表の開始位置を渡すために用いる。</p>
  10.  * <p>表の開始位置の指定は、{@link XlsIterateTables}で指定済みなので、{@link #headerColumn()}、{@link #headerRow()}以外での開始位置の指定は無効にする。</p>
  11.  *
  12.  * @version 2.0
  13.  * @author Mitsuyoshi Hasegawa
  14.  * @author T.TSUCHIE
  15.  */
  16. public class XlsHorizontalRecordsForIterateTables implements XlsHorizontalRecords {

  17.     private final Class<? extends Annotation> _annotationType;

  18.     private int _headerColumn = -1;
  19.     private int _headerRow = -1;
  20.     private String _headerAddress = "";
  21.     private boolean _optional = false;
  22.     private int _range = -1;
  23.     private Class<?> _recordClass = null;
  24.     private String _tableLabel = "";
  25.     private RecordTerminal _terminal = null;
  26.     private String _terminateLabel = null;
  27.     private int _bottom = 1;
  28.     private int _headerLimit = 0;
  29.     private int _headerBottom = 1;
  30.     private ProcessCase[] _cases = {};

  31.     /**
  32.      * アノテーションを元に、インスタンスを作成する。
  33.      * @param anno 元のアノテーション情報
  34.      * @param headerColumn 表の見出しの位置 - 列番号
  35.      * @param headerRow 表の見出しの位置 - 行番号
  36.      */
  37.     public XlsHorizontalRecordsForIterateTables(final XlsHorizontalRecords anno, int headerColumn, int headerRow) {
  38.         this._annotationType = anno.annotationType();

  39.         this._headerColumn = headerColumn;
  40.         this._headerRow = headerRow;

  41.         // headerColumn、headerRowを指定しているため、headerAddressは空で固定する。
  42.         this._headerAddress = "";

  43.         // 表の開始位置は、headerColumn, headerRowで指定するため、タイトルによる位置指定は無効にする。
  44.         this._tableLabel = "";
  45.         this._bottom = 1;

  46.         this._optional = anno.optional();
  47.         this._range = anno.range();
  48.         this._recordClass = anno.recordClass();

  49.         this._terminal = anno.terminal();
  50.         this._terminateLabel = anno.terminateLabel();

  51.         this._headerLimit = anno.headerLimit();
  52.         this._headerBottom = anno.headerBottom();

  53.         this._cases = anno.cases();

  54.     }

  55.     @Override
  56.     public int headerColumn() {
  57.         return this._headerColumn;
  58.     }

  59.     @Override
  60.     public int headerRow() {
  61.         return this._headerRow;
  62.     }

  63.     @Override
  64.     public String headerAddress() {
  65.         return this._headerAddress;
  66.     }

  67.     @Override
  68.     public boolean optional() {
  69.         return this._optional;
  70.     }

  71.     @Override
  72.     public int range() {
  73.         return this._range;
  74.     }

  75.     @Override
  76.     public Class<?> recordClass() {
  77.         return this._recordClass;
  78.     }

  79.     @Override
  80.     public String tableLabel() {
  81.         return this._tableLabel;
  82.     }

  83.     @Override
  84.     public RecordTerminal terminal() {
  85.         return this._terminal;
  86.     }

  87.     @Override
  88.     public Class<? extends Annotation> annotationType() {
  89.         return this._annotationType;
  90.     }

  91.     @Override
  92.     public String terminateLabel() {
  93.         return this._terminateLabel;
  94.     }

  95.     @Override
  96.     public int bottom() {
  97.         return this._bottom;
  98.     }

  99.     @Override
  100.     public int headerLimit() {
  101.         return this._headerLimit;
  102.     }

  103.     @Override
  104.     public int headerBottom() {
  105.         return this._headerBottom;
  106.     }

  107.     @Override
  108.     public ProcessCase[] cases() {
  109.         return this._cases;
  110.     }

  111. }