DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=34099>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=34099 ------- Additional Comments From [EMAIL PROTECTED] 2005-03-21 15:21 ------- note that for enums, you write the converter only once for all your enums: public class EnumConverter implements Converter { public Object convert(Class classs, Object value) { if (value == null) { throw new ConversionException("No value specified"); } if (value.getClass() == classs) { return value; } String strValue = value.toString(); try { return EnumUtils.getEnum(classs, strValue); } catch (Exception e) { throw new ConversionException("Could not convert " + strValue, e); } } } then, your code is getProperty("foo", MyEnum.class) and you get the enum. also, the enum is the obvious example. generally speaking, i think that writing: public class Foo { private static void Bar b = Config.getConfiguration().getProperty("foo.bar", Bar.class); } is nicer than: private static void Bar b = Bar.fromString(Config.getConfiguration(). getProperty("foo.bar")); moreover, note that the latter form means the property must be a string, but what if the property can be kept as Bar (e.g., a blob in the DB) then, getProperty("foo.bar", Bar.class) is more suitable, since it will just return the property as-is. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
