added Resources calss to access teh properties
This commit is contained in:
33
Projekte/mdga/model/src/main/java/pp/mdga/Resources.java
Normal file
33
Projekte/mdga/model/src/main/java/pp/mdga/Resources.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package pp.mdga;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Provides access to the resource bundle of the game.
|
||||
*
|
||||
* @see #BUNDLE
|
||||
*/
|
||||
public class Resources {
|
||||
/**
|
||||
* The resource bundle for the MDGA game.
|
||||
*/
|
||||
public static final ResourceBundle BUNDLE = ResourceBundle.getBundle("mdga"); //NON-NLS
|
||||
|
||||
/**
|
||||
* Gets a string for the given key from the resource bundle in {@linkplain #BUNDLE}.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @return the string for the given key
|
||||
* @throws NullPointerException if {@code key} is {@code null}
|
||||
* @throws java.util.MissingResourceException if no object for the given key can be found
|
||||
* @throws ClassCastException if the object found for the given key is not a string
|
||||
*/
|
||||
public static String lookup(String key) {
|
||||
return BUNDLE.getString(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor to prevent instantiation.
|
||||
*/
|
||||
private Resources() { /* do not instantiate */ }
|
||||
}
|
||||
Reference in New Issue
Block a user