@Override public void setAsText(@Nullable String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasLength(text)) { // Treat empty String as null value. setValue(null); } else if (text == null) { throw new IllegalArgumentException("null String cannot be converted to char type"); } else if (isUnicodeCharacterSequence(text)) { setAsUnicode(text); } else if (text.length() == 1) { setValue(Character.valueOf(text.charAt(0))); } else { throw new IllegalArgumentException("String [" + text + "] with length " + text.length() + " cannot be converted to char type: neither Unicode nor single character"); } }
@Override public void setAsText(@Nullable String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasLength(text)) { // Treat empty String as null value. setValue(null); } else if (text == null) { throw new IllegalArgumentException("null String cannot be converted to char type"); } else if (isUnicodeCharacterSequence(text)) { setAsUnicode(text); } else if (text.length() == 1) { setValue(Character.valueOf(text.charAt(0))); } else { throw new IllegalArgumentException("String [" + text + "] with length " + text.length() + " cannot be converted to char type: neither Unicode nor single character"); } }
@Override public void setAsText(String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasLength(text)) { // Treat empty String as null value. setValue(null); } else if (text == null) { throw new IllegalArgumentException("null String cannot be converted to char type"); } else if (isUnicodeCharacterSequence(text)) { setAsUnicode(text); } else if (text.length() != 1) { throw new IllegalArgumentException("String [" + text + "] with length " + text.length() + " cannot be converted to char type"); } else { setValue(new Character(text.charAt(0))); } }
@Override public void setAsText(String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasLength(text)) { // Treat empty String as null value. setValue(null); } else if (text == null) { throw new IllegalArgumentException("null String cannot be converted to char type"); } else if (isUnicodeCharacterSequence(text)) { setAsUnicode(text); } else if (text.length() == 1) { setValue(Character.valueOf(text.charAt(0))); } else { throw new IllegalArgumentException("String [" + text + "] with length " + text.length() + " cannot be converted to char type: neither Unicode nor single character"); } }