tidying string to char conversion

This commit is contained in:
Keith Donald
2009-09-17 20:05:38 +00:00
parent 5c3e71d494
commit e153a1a968

View File

@@ -30,6 +30,9 @@ class StringToCharacterConverter implements Converter<String, Character> {
if ("".equals(source)) {
return null;
}
if (source.length() > 1) {
throw new IllegalArgumentException("Can only convert a [String] with length of 1 to a [Character]; string value '" + source + "' has length of " + source.length());
}
return source.charAt(0);
}