/** * @see com.swabunga.spell.engine.Configuration#setBoolean(String, boolean) */ public void setBoolean(String key, boolean value) { String string = null; if (value) string = "true"; else string = "false"; prop.setProperty(key, string); save(); }
/** * Returns a new instance of a Configuration class * @param className - the class to return, must be based on Configuration * @return Configuration */ public static final Configuration getConfiguration(String className) { Configuration result; if (className != null && className.length() > 0) { try { result = (Configuration) Class.forName(className).newInstance(); } catch (InstantiationException e) { result = new PropertyConfiguration(); } catch (IllegalAccessException e) { result = new PropertyConfiguration(); } catch (ClassNotFoundException e) { result = new PropertyConfiguration(); } } else { result = new PropertyConfiguration(); } return result; } }
/** * @see com.swabunga.spell.engine.Configuration#setInteger(String, int) */ public void setInteger(String key, int value) { prop.setProperty(key, Integer.toString(value)); save(); }