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.data;
17  
18  import com.ancientprogramming.fixedformat4j.annotation.FixedFormatDecimal;
19  import static com.ancientprogramming.fixedformat4j.annotation.FixedFormatDecimal.*;
20  
21  /**
22   * Data object containing the exact same data as {@link FixedFormatDecimal}
23   *
24   * @author Jacob von Eyben - http://www.ancientprogramming.com
25   * @since 1.0.0
26   */
27  public class FixedFormatDecimalData {
28  
29    private int decimals;
30    private boolean useDecimalDelimiter;
31    private char decimalDelimiter;
32    public static final FixedFormatDecimalData DEFAULT = new FixedFormatDecimalData(DECIMALS, USE_DECIMAL_DELIMITER, DECIMAL_DELIMITER);
33  
34    public FixedFormatDecimalData(int decimals, boolean useDecimalDelimiter, char decimalDelimiter) {
35      this.decimals = decimals;
36      this.useDecimalDelimiter = useDecimalDelimiter;
37      this.decimalDelimiter = decimalDelimiter;
38    }
39  
40    public int getDecimals() {
41      return decimals;
42    }
43  
44    public boolean isUseDecimalDelimiter() {
45      return useDecimalDelimiter;
46    }
47  
48    public char getDecimalDelimiter() {
49      return decimalDelimiter;
50    }
51  
52  
53    public String toString() {
54      return "FixedFormatDecimalData{" +
55          "decimals=" + decimals +
56          ", useDecimalDelimiter=" + useDecimalDelimiter +
57          ", decimalDelimiter='" + decimalDelimiter + "'" + 
58          '}';
59    }
60  }