Class CharacterEditor
- java.lang.Object
- java.beans.PropertyEditorSupport
- org.springframework.beans.propertyeditors.CharacterEditor
- All Implemented Interfaces:
PropertyEditor
public class CharacterEditor extends PropertyEditorSupport
Editor for aCharacter, to populate a property of typeCharacterorcharfrom a String value.Note that the JDK does not contain a default
property editorforchar!BeanWrapperImplwill register this editor by default.Also supports conversion from a Unicode character sequence; e.g.
u0041('A').- Since:
- 1.2
- Author:
- Juergen Hoeller, Rob Harrop, Rick Evans
- See Also:
Character,BeanWrapperImpl
Constructor Summary
Constructors Constructor Description CharacterEditor(boolean allowEmpty)Create a new CharacterEditor instance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAsText()voidsetAsText(String text)Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
Constructor Detail
CharacterEditor
public CharacterEditor(boolean allowEmpty)
Create a new CharacterEditor instance.The "allowEmpty" parameter controls whether an empty String is to be allowed in parsing, i.e. be interpreted as the
nullvalue whentext is being converted. Iffalse, anIllegalArgumentExceptionwill be thrown at that time.- Parameters:
allowEmpty- if empty strings are to be allowed
Method Detail
setAsText
public void setAsText(@Nullable String text) throws IllegalArgumentException
- Specified by:
setAsTextin interfacePropertyEditor- Overrides:
setAsTextin classPropertyEditorSupport- Throws:
IllegalArgumentException
getAsText
public String getAsText()
- Specified by:
getAsTextin interfacePropertyEditor- Overrides:
getAsTextin classPropertyEditorSupport