View Javadoc
1   package com.opencsv.bean.mocks.profile;
2   
3   import com.opencsv.bean.*;
4   import com.opencsv.bean.customconverter.ConvertFrenchToBoolean;
5   import com.opencsv.bean.customconverter.ConvertGermanToBoolean;
6   import org.apache.commons.collections4.MultiValuedMap;
7   
8   import java.time.LocalDate;
9   import java.util.LinkedList;
10  import java.util.List;
11  import java.util.Stack;
12  
13  public class ProfilePositionMock {
14  
15      @CsvBindByPosition(position = 0)
16      @CsvBindByPosition(position = 0, capture = "integer: ([0-9]+)", format = "integer: %s", profiles = {"profile 1"})
17      @CsvBindByPosition(position = 0, capture = "int ([0-9]+) value", format = "int %s value", profiles = {"profile 2"})
18      private int int1;
19  
20      @CsvCustomBindByPositions({
21              @CsvCustomBindByPosition(position = 1, converter = ConvertGermanToBoolean.class, profiles = {"profile 1", "profile 2"}),
22              @CsvCustomBindByPosition(position = 1, converter = ConvertFrenchToBoolean.class, profiles = {"", "profile 3"})
23      })
24      private boolean bool1;
25  
26      @CsvBindAndSplitByPosition(position = 2, elementType = Float.class)
27      @CsvNumber("#0.0#'%'")
28      @CsvBindAndSplitByPositions({
29              @CsvBindAndSplitByPosition(position = 2, elementType = Float.class, collectionType = LinkedList.class, profiles = "profile 1"),
30              @CsvBindAndSplitByPosition(position = 2, elementType = Float.class, collectionType = Stack.class, profiles = "profile 2")
31      })
32      @CsvNumbers({
33              @CsvNumber(value = "#0.000#", profiles = "profile 1"),
34              @CsvNumber(value = "0.0#E0", profiles = "profile 2")
35      })
36      private List<Float> floats;
37  
38      @CsvBindAndJoinByPositions({
39              @CsvBindAndJoinByPosition(position = "3-4", elementType = LocalDate.class),
40              @CsvBindAndJoinByPosition(
41                      elementType = LocalDate.class,
42                      profiles = {"profile 1", "profile 2", "profile 3"},
43                      position = "3-4")
44      })
45      @CsvDates({
46              @CsvDate("MM/dd/yyyy"),
47              @CsvDate(value = "dd. MMMM yyyy", profiles = {"profile 1", "profile 2", "profile 3"})
48      })
49      private MultiValuedMap<Integer, LocalDate> dates;
50  
51      @CsvIgnore(profiles = "profile 2")
52      @CsvBindByPosition(position = 5, profiles = "profile 2")
53      @CsvBindByPosition(position = 5, profiles = "profile 3")
54      private String string1;
55  
56      @CsvIgnore
57      @CsvBindByPosition(position = 6, profiles = "profile 2")
58      @CsvBindByPosition(position = 6, profiles = "profile 3")
59      private String string2;
60  
61      public int getInt1() {
62          return int1;
63      }
64  
65      public void setInt1(int int1) {
66          this.int1 = int1;
67      }
68  
69      public boolean isBool1() {
70          return bool1;
71      }
72  
73      public void setBool1(boolean bool1) {
74          this.bool1 = bool1;
75      }
76  
77      public List<Float> getFloats() {
78          return floats;
79      }
80  
81      public void setFloats(List<Float> floats) {
82          this.floats = floats;
83      }
84  
85      public MultiValuedMap<Integer, LocalDate> getDates() {
86          return dates;
87      }
88  
89      public void setDates(MultiValuedMap<Integer, LocalDate> dates) {
90          this.dates = dates;
91      }
92  
93      public String getString1() {
94          return string1;
95      }
96  
97      public void setString1(String string1) {
98          this.string1 = string1;
99      }
100 
101     public String getString2() {
102         return string2;
103     }
104 
105     public void setString2(String string2) {
106         this.string2 = string2;
107     }
108 }