XlsVerticalRecordsForIterateTables.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.IterateTablesProcessor;
  5. import com.gh.mygreen.xlsmapper.fieldprocessor.impl.VerticalRecordsProcessor;

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

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

  18.     private int _headerColumn = -1;
  19.     private int _headerRow = -1;
  20.     private String _headerAddress = "";

  21.     private String _tableLabel = "";
  22.     private boolean _tableLabelAvobe;

  23.     private boolean _optional = false;
  24.     private int _range = -1;
  25.     private Class<?> _recordClass = null;

  26.     private RecordTerminal _terminal = null;
  27.     private String _terminateLabel = null;

  28.     private int _bottom = 1;
  29.     private int _right = 1;

  30.     private int _headerLimit = 0;
  31.     private int _headerRight = 1;

  32.     private ProcessCase[] _cases = {};

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

  41.         this._headerColumn = headerColumn;
  42.         this._headerRow = headerRow;

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

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

  49.         this._optional = anno.optional();
  50.         this._range = anno.range();
  51.         this._recordClass = anno.recordClass();

  52.         this._terminal = anno.terminal();
  53.         this._terminateLabel = anno.terminateLabel();

  54.         this._right = anno.right();

  55.         this._headerLimit = anno.headerLimit();
  56.         this._headerRight = anno.headerRight();

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

  58.     }

  59.     @Override
  60.     public Class<? extends Annotation> annotationType() {
  61.         return _annotationType;
  62.     }

  63.     @Override
  64.     public boolean optional() {
  65.         return _optional;
  66.     }

  67.     @Override
  68.     public String tableLabel() {
  69.         return _tableLabel;
  70.     }

  71.     @Override
  72.     public boolean tableLabelAbove() {
  73.         return _tableLabelAvobe;
  74.     }

  75.     @Override
  76.     public String terminateLabel() {
  77.         return _terminateLabel;
  78.     }

  79.     @Override
  80.     public int headerColumn() {
  81.         return _headerColumn;
  82.     }

  83.     @Override
  84.     public int headerRow() {
  85.         return _headerRow;
  86.     }

  87.     @Override
  88.     public String headerAddress() {
  89.         return _headerAddress;
  90.     }

  91.     @Override
  92.     public Class<?> recordClass() {
  93.         return _recordClass;
  94.     }

  95.     @Override
  96.     public RecordTerminal terminal() {
  97.         return _terminal;
  98.     }

  99.     @Override
  100.     public int range() {
  101.         return _range;
  102.     }

  103.     @Override
  104.     public int right() {
  105.         return _right;
  106.     }

  107.     @Override
  108.     public int bottom() {
  109.         return _bottom;
  110.     }

  111.     @Override
  112.     public int headerLimit() {
  113.         return _headerLimit;
  114.     }

  115.     @Override
  116.     public int headerRight() {
  117.         return _headerRight;
  118.     }

  119.     @Override
  120.     public ProcessCase[] cases() {
  121.         return _cases;
  122.     }

  123. }