org.springframework.beans.propertyeditors
Class StringTrimmerEditor

java.lang.Object
  |
  +--java.beans.PropertyEditorSupport
        |
        +--org.springframework.beans.propertyeditors.StringTrimmerEditor

public class StringTrimmerEditor
extends PropertyEditorSupport

Property editor that trims Strings. Allows to transform an empty string into a null value. Needs to be explictly registered, e.g. for command binding.

Author:
Juergen Hoeller
See Also: org.springframework.validation.DataBinder.registerCustomEditor(java.lang.Class,java.beans.PropertyEditor), org.springframework.web.servlet.mvc.BaseCommandController.initBinder(HttpServletRequest,org.springframework.web.bind.ServletRequestDataBinder), org.springframework.web.bind.BindInitializer.initBinder(ServletRequest,org.springframework.web.bind.ServletRequestDataBinder)

Constructor Summary
StringTrimmerEditor(boolean emptyAsNull)
          Create a new instance.

Method Summary
 voidsetAsText(String text)
           

Methods inherited from class java.beans.PropertyEditorSupport
firePropertyChange, isPaintable, supportsCustomEditor, getCustomEditor, addPropertyChangeListener, removePropertyChangeListener, getValue, setValue, getAsText, getJavaInitializationString, getTags, paintValue

Methods inherited from class java.lang.Object
hashCode, notify, notifyAll, wait, wait, wait, getClass, equals, toString

Constructor Detail

StringTrimmerEditor

public StringTrimmerEditor(boolean emptyAsNull)
Create a new instance.
Parameters:
emptyAsNull - whether to transform an empty string to null
Method Detail

setAsText

public void setAsText(String text)
throws java.lang.IllegalArgumentException