1 package com.github.mygreen.supercsv.io;
2
3 import java.time.LocalDate;
4
5 import com.github.mygreen.supercsv.annotation.CsvBean;
6 import com.github.mygreen.supercsv.annotation.CsvColumn;
7 import com.github.mygreen.supercsv.annotation.conversion.CsvFixedSize;
8 import com.github.mygreen.supercsv.annotation.conversion.CsvFullChar;
9 import com.github.mygreen.supercsv.annotation.format.CsvDateTimeFormat;
10 import com.github.mygreen.supercsv.builder.FixedSizeHeaderMapper;
11 import com.github.mygreen.supercsv.cellprocessor.conversion.CharWidthPaddingProcessor;
12
13
14
15
16
17
18
19
20
21 @CsvBean(header=false, headerMapper=FixedSizeHeaderMapper.class)
22 public class SampleLazyFixedColumnBean {
23
24
25 @CsvColumn(number=1)
26 @CsvFixedSize(size=5, rightAlign=true)
27 private int no;
28
29
30
31 @CsvColumn(label="ユーザ名")
32 @CsvFullChar
33 @CsvFixedSize(size=20, padChar=' ', paddingProcessor=CharWidthPaddingProcessor.class)
34 private String userName;
35
36
37 @CsvColumn(label="誕生日")
38 @CsvFixedSize(size=10, padChar='_')
39 @CsvDateTimeFormat(pattern="uuuu-MM-dd")
40 private LocalDate birthDay;
41
42
43 @CsvColumn(label="コメント")
44 @CsvFixedSize(size=20, rightAlign=false, chopped=true, paddingProcessor=CharWidthPaddingProcessor.class)
45 private String comment;
46
47 public int getNo() {
48 return no;
49 }
50
51 public void setNo(int no) {
52 this.no = no;
53 }
54
55 public String getUserName() {
56 return userName;
57 }
58
59 public void setUserName(String userName) {
60 this.userName = userName;
61 }
62
63 public LocalDate getBirthDay() {
64 return birthDay;
65 }
66
67 public void setBirthDay(LocalDate birthDay) {
68 this.birthDay = birthDay;
69 }
70
71 public String getComment() {
72 return comment;
73 }
74
75 public void setComment(String comment) {
76 this.comment = comment;
77 }
78
79 }