+1, toCharacter returning a char is funky. Good suggestions.
Stephen, any objections? Gary > -----Original Message----- > From: Janek Bogucki [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 18, 2004 02:36 > To: Jakarta Commons Developers List > Subject: [lang] CharUtils: toCharacterObject, toCharacter -> toCharacter, > toChar? > > CharUtils features these API methods: > > public static Character toCharacterObject(char ch) > public static char toCharacter(Character ch) > public static char toCharacter(String str) > > public static int toInteger(char ch) > public static int toInteger(Character ch) > > Although 'toCharacterObject' is very clear, 'toCharacter' is slightly > ambiguous unless it is taken in context with 'toCharacterObject'. > 'toCharacter' suggests the return type will be a Character object when it > is > actually char. > > As a suggestion, this API would be clearer: > > public static Character toCharacter(char ch) > public static char toChar(Character ch) > public static char toChar(String str) > > public static int toInt(char ch) > public static int toInt(Character ch) > > > CharUtils is since lang 2.1 so there is no 'published' API to worry about. > (I've omitted the methods overloaded with defaults but they would also be > subject to this proposed change.) > > As a side benefit of this API change the two 'toString' methods don't need > to > have 'Object' appended to be consistent with 'toCharacterObject': > > public static String toString(char ch) > public static String toString(Character ch) > > i.e. they stay as is instead of becoming: > > public static String toStringObject(char ch) > public static String toStringObject(Character ch) > > -Janek > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]