View Javadoc
1   package com.github.mygreen.supercsv.io;
2   
3   import java.io.Serializable;
4   import java.time.LocalDate;
5   
6   import com.github.mygreen.supercsv.annotation.CsvBean;
7   import com.github.mygreen.supercsv.annotation.CsvColumn;
8   import com.github.mygreen.supercsv.annotation.constraint.CsvRequire;
9   import com.github.mygreen.supercsv.annotation.format.CsvDateTimeFormat;
10  
11  /**
12   * テスト用の名前によるマッピング
13   *
14   * @since 2.1
15   * @author T.TSUCHIE
16   *
17   */
18  @CsvBean(header=true, validateHeader=true)
19  public class SampleLazyBean implements Serializable {
20  
21      /** serialVersionUID */
22      private static final long serialVersionUID = 1L;
23      
24      // ラベルがフィールド名
25      @CsvColumn
26      @CsvRequire
27      private int no;
28      
29      // 列番号を指定
30      @CsvColumn(number=2)
31      @CsvRequire
32      private String name;
33      
34      // ラベルだけ指定
35      @CsvColumn(label="生年月日")
36      @CsvDateTimeFormat(pattern="uuuu/MM/dd")
37      private LocalDate birthday;
38      
39      // 番号とラベルの両方を指定
40      @CsvColumn(number=4, label="備考")
41      private String comment;
42      
43      public int getNo() {
44          return no;
45      }
46      
47      public void setNo(int no) {
48          this.no = no;
49      }
50      
51      public String getName() {
52          return name;
53      }
54      
55      public void setName(String name) {
56          this.name = name;
57      }
58      
59      public LocalDate getBirthday() {
60          return birthday;
61      }
62      
63      public void setBirthday(LocalDate birthday) {
64          this.birthday = birthday;
65      }
66      
67      public String getComment() {
68          return comment;
69      }
70      
71      public void setComment(String comment) {
72          this.comment = comment;
73      }
74      
75  }