diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/Resources.java b/Projekte/mdga/model/src/main/java/pp/mdga/Resources.java new file mode 100644 index 00000000..a8c3bf82 --- /dev/null +++ b/Projekte/mdga/model/src/main/java/pp/mdga/Resources.java @@ -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 */ } +}