1   /*
2    * Copyright 2004 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.ancientprogramming.fixedformat4j.format.impl;
17  
18  import com.ancientprogramming.fixedformat4j.annotation.*;
19  
20  import java.math.BigDecimal;
21  import java.util.Date;
22  
23  /**
24   * A record used in testcases
25   *
26   * @author Jacob von Eyben - http://www.ancientprogramming.com
27   * @since 1.0.0
28   */
29  @Record
30  public class MyRecord {
31  
32    private String stringData;
33    private Integer integerData;
34    private Date dateData;
35    private Character charData;
36    private Boolean booleanData;
37    private Long longData;
38    private Double doubleData;
39    private Float floatData;
40    private BigDecimal bigDecimalData;
41    private float simpleFloatData;
42  
43  
44    @Field(offset = 1, length = 10, align = Align.RIGHT, paddingChar = ' ')
45    public String getStringData() {
46      return stringData;
47    }
48  
49    public void setStringData(String stringData) {
50      this.stringData = stringData;
51    }
52  
53    @Field(offset = 11, length = 5, align = Align.RIGHT, paddingChar = '0')
54    public Integer getIntegerData() {
55      return integerData;
56    }
57  
58    public void setIntegerData(Integer integerData) {
59      this.integerData = integerData;
60    }
61  
62    @Field(offset = 16, length = 8)
63    public Date getDateData() {
64      return dateData;
65    }
66  
67    public void setDateData(Date dateData) {
68      this.dateData = dateData;
69    }
70  
71    @Field(offset = 24, length = 1)
72    public Character getCharData() {
73      return charData;
74    }
75  
76    public void setCharData(Character charData) {
77      this.charData = charData;
78    }
79  
80    @Field(offset = 25, length = 1)
81    public Boolean isBooleanData() {
82      return booleanData;
83    }
84  
85    public void setBooleanData(Boolean booleanData) {
86      this.booleanData = booleanData;
87    }
88  
89    @Field(offset = 26, length = 4, align = Align.RIGHT, paddingChar = '0')
90    public Long getLongData() {
91      return longData;
92    }
93  
94    public void setLongData(Long longData) {
95      this.longData = longData;
96    }
97  
98    @Field(offset = 30, length = 10, align = Align.RIGHT, paddingChar = '0')
99    public Double getDoubleData() {
100     return doubleData;
101   }
102 
103   public void setDoubleData(Double doubleData) {
104     this.doubleData = doubleData;
105   }
106 
107   @Field(offset = 40, length = 10, align = Align.RIGHT, paddingChar = '0')
108   public Float getFloatData() {
109     return floatData;
110   }
111 
112   public void setFloatData(Float floatData) {
113     this.floatData = floatData;
114   }
115 
116   @Field(offset = 50, length = 10, align = Align.RIGHT, paddingChar = '0')
117   @FixedFormatDecimal(decimals = 4, decimalDelimiter = ' ', useDecimalDelimiter = true)
118   @FixedFormatNumber(sign = Sign.PREPEND)
119   public BigDecimal getBigDecimalData() {
120     return bigDecimalData;
121   }
122 
123   public void setBigDecimalData(BigDecimal bigDecimalData) {
124     this.bigDecimalData = bigDecimalData;
125   }
126 
127   @Field(offset = 60, length = 10, align = Align.RIGHT, paddingChar = '0')
128   public float getSimpleFloatData() {
129     return simpleFloatData;
130   }
131 
132   public void setSimpleFloatData(float simpleFloatData) {
133     this.simpleFloatData = simpleFloatData;
134   }
135 
136 
137   @Record
138   static class MyStaticNestedClass {
139 
140     private String stringData;
141 
142     @Field(offset = 1, length = 10)
143     public String getStringData() {
144       return stringData;
145     }
146 
147     public void setStringData(String stringData) {
148       this.stringData = stringData;
149     }
150   }
151 
152   @Record
153   class MyInnerClass {
154 
155     private String stringData;
156 
157     @Field(offset = 1, length = 10)
158     public String getStringData() {
159       return stringData;
160     }
161 
162     public void setStringData(String stringData) {
163       this.stringData = stringData;
164     }
165   }
166 }