View Javadoc

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;
17  
18  import com.ancientprogramming.fixedformat4j.annotation.Align;
19  import com.ancientprogramming.fixedformat4j.format.data.FixedFormatBooleanData;
20  import com.ancientprogramming.fixedformat4j.format.data.FixedFormatPatternData;
21  import com.ancientprogramming.fixedformat4j.format.data.FixedFormatDecimalData;
22  import com.ancientprogramming.fixedformat4j.format.data.FixedFormatNumberData;
23  
24  /**
25   * Contains instructions on how to export and load fixed formatted data.
26   *
27   * @author Jacob von Eyben - http://www.ancientprogramming.com
28   * @since 1.0.0
29   */
30  public class FormatInstructions {
31  
32    private int length;
33    private Align alignment;
34    private char paddingChar;
35    private FixedFormatPatternData fixedFormatPatternData;
36    private FixedFormatBooleanData fixedFormatBooleanData;
37    private FixedFormatNumberData fixedFormatNumberData;
38    private FixedFormatDecimalData fixedFormatDecimalData;
39  
40    public FormatInstructions(int length, Align alignment, char paddingChar, FixedFormatPatternData fixedFormatPatternData, FixedFormatBooleanData fixedFormatBooleanData, FixedFormatNumberData fixedFormatNumberData, FixedFormatDecimalData fixedFormatDecimalData) {
41      this.length = length;
42      this.alignment = alignment;
43      this.paddingChar = paddingChar;
44      this.fixedFormatPatternData = fixedFormatPatternData;
45      this.fixedFormatBooleanData = fixedFormatBooleanData;
46      this.fixedFormatNumberData = fixedFormatNumberData;
47      this.fixedFormatDecimalData = fixedFormatDecimalData;
48    }
49  
50    public int getLength() {
51      return length;
52    }
53  
54    public Align getAlignment() {
55      return alignment;
56    }
57  
58    public char getPaddingChar() {
59      return paddingChar;
60    }
61  
62    public FixedFormatPatternData getFixedFormatPatternData() {
63      return fixedFormatPatternData;
64    }
65  
66    public FixedFormatBooleanData getFixedFormatBooleanData() {
67      return fixedFormatBooleanData;
68    }
69  
70    public FixedFormatDecimalData getFixedFormatDecimalData() {
71      return fixedFormatDecimalData;
72    }
73  
74    public FixedFormatNumberData getFixedFormatNumberData() {
75      return fixedFormatNumberData;
76    }
77  
78    public String toString() {
79      return "FormatInstructions{" +
80          "length=" + length +
81          ", alignment=" + alignment +
82          ", paddingChar='" + paddingChar + "'" + 
83          ", fixedFormatPatternData=" + fixedFormatPatternData +
84          ", fixedFormatBooleanData=" + fixedFormatBooleanData +
85          ", fixedFormatNumberData=" + fixedFormatNumberData +
86          ", fixedFormatDecimalData=" + fixedFormatDecimalData +
87          '}';
88    }
89  }