]> git.mxchange.org Git - jcore-utils.git/blob - src/org/mxchange/jcoreee/BaseEeSystem.java
BaseEeSystem is now centralized and serializable
[jcore-utils.git] / src / org / mxchange / jcoreee / BaseEeSystem.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
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.jcoreee;
18
19 import java.io.Serializable;
20 import java.util.ResourceBundle;
21
22 /**
23  *
24  * @author Roland Haeder<roland@mxchange.org>
25  */
26 public class BaseEeSystem implements Serializable {
27
28         /**
29          * Serial number
30          */
31         private static final long serialVersionUID = 48_475_834_783_473_187L;
32
33         /**
34          * Bundle instance
35          */
36         private final ResourceBundle bundle;
37
38         /**
39          * Protectd constructor
40          */
41         protected BaseEeSystem () {
42                 // Load resource bundle
43                 this.bundle = ResourceBundle.getBundle("org/mxchange/localization/bundle");
44         }
45
46         /**
47          * Getter for message from given key
48          *
49          * @param key Key to get message from
50          * @return Message
51          */
52         protected String getMessageStringFromKey (final String key) {
53                 // Is the bundle loaded?
54                 if (this.getBundle() == null) {
55                         // Abort here
56                         throw new NullPointerException("bundle is null"); //NOI18N
57                 }
58
59                 // Return message
60                 return this.getBundle().getString(key);
61         }
62
63         /**
64          * Getter for bundle instance
65          *
66          * @return Bundle instance
67          */
68         protected ResourceBundle getBundle () {
69                 return this.bundle;
70         }
71 }