]> git.mxchange.org Git - jfinancials-core.git/blob - src/org/mxchange/jfinancials/model/income/interval/FinancialInterval.java
d2e182dc21888a59d7ab1c6a9c4f71ec3dc52f25
[jfinancials-core.git] / src / org / mxchange / jfinancials / model / income / interval / FinancialInterval.java
1 /*
2  * Copyright (C) 2016 - 2022 Free Software Foundation
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jfinancials.model.income.interval;
18
19 import java.io.Serializable;
20
21 /**
22  * An enumeration for income/expenses intervals
23  * <p>
24  * @author Roland Häder<roland@mxchange.org>
25  */
26 public enum FinancialInterval implements Serializable {
27
28         /**
29          * Daily
30          */
31         DAILY("FINANCIAL_INTERVAL_DAILY", "financial_interval_daily"), //NOI18N
32
33         /**
34          * Weekly
35          */
36         WEEKLY("FINANCIAL_INTERVAL_WEEKLY", "financial_interval_weekly"), //NOI18N
37
38         /**
39          * Monthly
40          */
41         MONTHLY("FINANCIAL_INTERVAL_MONTHLY", "financial_interval_monthly"), //NOI18N
42
43         /**
44          * Yearly
45          */
46         YEARLY("FINANCIAL_INTERVAL_YEARLY", "financial_interval_yearly"); //NOI18N
47
48         /**
49          * Message key
50          */
51         private final String messageKey;
52
53         /**
54          * CSS style class
55          */
56         private final String styleClass;
57
58         /**
59          * Constructor with i18n translation key and CSS style class
60          * <p>
61          * @param messageKey Message key (i18n)
62          * @param styleClass CSS style class
63          */
64         private FinancialInterval (final String messageKey, final String styleClass) {
65                 // Validate parameter
66                 if (null == messageKey) {
67                         // Throw NPE
68                         throw new NullPointerException("messageKey is null"); //NOI18N
69                 } else if (messageKey.isEmpty()) {
70                         // Throw IAE
71                         throw new IllegalArgumentException("messageKey is empty"); //NOI18N
72                 } else if (null == styleClass) {
73                         // Throw NPE
74                         throw new NullPointerException("styleClass is null"); //NOI18N
75                 } else if (styleClass.isEmpty()) {
76                         // Throw IAE
77                         throw new IllegalArgumentException("styleClass is empty"); //NOI18N
78                 }
79
80                 // Set it here
81                 this.messageKey = messageKey;
82                 this.styleClass = styleClass;
83         }
84
85         /**
86          * Getter for message key
87          * <p>
88          * @return Message key (i18n)
89          */
90         public String getMessageKey () {
91                 return this.messageKey;
92         }
93
94         /**
95          * Getter for CSS style class
96          * <p>
97          * @return CSS style class
98          */
99         public String getStyleClass () {
100                 return this.styleClass;
101         }
102
103 }