1 package com.github.mygreen.supercsv.builder;
2
3 import org.supercsv.cellprocessor.ift.CellProcessor;
4
5 import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
6
7
8
9
10
11
12
13
14 public class ColumnMapping implements Comparable<ColumnMapping> {
15
16 private FieldAccessor field;
17
18 private String label;
19
20 private int number;
21
22
23
24
25 private boolean partialized;
26
27 private CellProcessor cellProcessorForReading;
28
29 private CellProcessor cellProcessorForWriting;
30
31 private TextFormatter<?> formatter;
32
33
34
35
36
37 @Override
38 public int compareTo(final ColumnMapping o) {
39
40 if(this.number == o.number) {
41 return this.field.getName().compareTo(o.field.getName());
42
43 } else {
44 return Integer.compare(number, o.number);
45 }
46
47 }
48
49
50
51
52
53
54 public boolean isDeterminedNumber() {
55 return number >= 1;
56 }
57
58
59
60
61
62
63 public String getName() {
64 return field != null ? field.getName() : null;
65 }
66
67
68
69
70
71 public FieldAccessor getField() {
72 return field;
73 }
74
75 public void setField(FieldAccessor field) {
76 this.field = field;
77 }
78
79
80
81
82
83 public String getLabel() {
84 return label;
85 }
86
87
88
89
90
91 public void setLabel(String label) {
92 this.label = label;
93 }
94
95
96
97
98
99 public int getNumber() {
100 return number;
101 }
102
103
104
105
106
107 public void setNumber(int number) {
108 this.number = number;
109 }
110
111
112
113
114
115 public boolean isPartialized() {
116 return partialized;
117 }
118
119
120
121
122
123 public void setPartialized(boolean partialized) {
124 this.partialized = partialized;
125 }
126
127 public CellProcessor getCellProcessorForReading() {
128 return cellProcessorForReading;
129 }
130
131 public void setCellProcessorForReading(CellProcessor cellProcessorForReading) {
132 this.cellProcessorForReading = cellProcessorForReading;
133 }
134
135 public CellProcessor getCellProcessorForWriting() {
136 return cellProcessorForWriting;
137 }
138
139 public void setCellProcessorForWriting(CellProcessor cellProcessorForWriting) {
140 this.cellProcessorForWriting = cellProcessorForWriting;
141 }
142
143
144
145
146
147 public TextFormatter<?> getFormatter() {
148 return formatter;
149 }
150
151 public void setFormatter(TextFormatter<?> formatter) {
152 this.formatter = formatter;
153 }
154 }