I\'ve added a human-readable configuration file to my app using java.util.Properties and am trying to add a wrapper around it to make type conversions easier. Specifically,
Try this:
protected T getProperty(String key, T fallback) { String value = properties.getProperty(key); if (value == null) { return fallback; } else { Class FallbackType = fallback.getClass(); return (T)FallbackType.cast(value); } }