org.jogre.common.util
Class AbstractProperties

java.lang.Object
  extended byorg.jogre.common.util.AbstractProperties
Direct Known Subclasses:
GameLabels, GameProperties, JogreLabels, JogreLookAndFeel

public abstract class AbstractProperties
extends Object

Abstract class which provides various methods which are common to GameProperties, GameLabels and JogreLabels.

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
protected  ResourceBundle rb
          Resource bundle.
 
Constructor Summary
protected AbstractProperties(String filename)
          Private constructor (Can only be called by the getInstance() method.
 
Method Summary
 String get(String key)
          Return the "value" for a specified "key" inside the resource bundle as a String.
 String get(String key, String defaultValue)
          Return the "value" for a specified "key" inside the resource bundle as a String.
 boolean getBoolean(String key)
          Return a boolean value from a key.
 boolean getBoolean(String key, boolean defaultValue)
          Return a boolean value from a key.
 int getInt(String key)
          Return the "value" for a specified "key" inside the resource bundle as an int value.
 int getInt(String key, int defaultValue)
          Return the "value" for a specified "key" inside the resource bundle as an int value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rb

protected ResourceBundle rb
Resource bundle.

Constructor Detail

AbstractProperties

protected AbstractProperties(String filename)
Private constructor (Can only be called by the getInstance() method.

Parameters:
filename -
Method Detail

get

public String get(String key)
Return the "value" for a specified "key" inside the resource bundle as a String.

Parameters:
key - Key to get value from.
Returns:
Trimed value from a specified trimmed key.

get

public String get(String key,
                  String defaultValue)
Return the "value" for a specified "key" inside the resource bundle as a String. If the value doesn't

Parameters:
key - Key to get value from.
defaultValue - Default value if key doesn't retrieve a value.
Returns:
String value.

getInt

public int getInt(String key)
Return the "value" for a specified "key" inside the resource bundle as an int value.

Parameters:
key - Key to get value from.
Returns:
String value.

getInt

public int getInt(String key,
                  int defaultValue)
Return the "value" for a specified "key" inside the resource bundle as an int value. If the value doesn't exist then return its defaultValue instead.

Parameters:
key - Key to get value from.
defaultValue - Default integer value if key isn't found.
Returns:
Integer value.

getBoolean

public boolean getBoolean(String key)
Return a boolean value from a key.

Parameters:
key - Key to get value from.
Returns:
Returns true if value="true"

getBoolean

public boolean getBoolean(String key,
                          boolean defaultValue)
Return a boolean value from a key. If the key doesn't exist then return the default value.

Parameters:
key - Key to get value from.
defaultValue - Default boolean value if key isn't found.
Returns:
Returns true if value="true" or default value if not value exists.