Class FormatterPropertyEditorAdapter
- java.lang.Object
- java.beans.PropertyEditorSupport
- org.springframework.format.support.FormatterPropertyEditorAdapter
- All Implemented Interfaces:
PropertyEditor
public class FormatterPropertyEditorAdapter extends PropertyEditorSupport
Adapter that bridges betweenFormatter
andPropertyEditor
.- Since:
- 4.2
- Author:
- Juergen Hoeller
Constructor Summary
Constructors Constructor Description FormatterPropertyEditorAdapter(Formatter<?> formatter)
Create a newFormatterPropertyEditorAdapter
for the givenFormatter
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsText()
Class<?>
getFieldType()
Determine theFormatter
-declared field type.void
setAsText(String text)
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
Constructor Detail
FormatterPropertyEditorAdapter
public FormatterPropertyEditorAdapter(Formatter<?> formatter)
Create a newFormatterPropertyEditorAdapter
for the givenFormatter
.- Parameters:
formatter
- theFormatter
to wrap
Method Detail
getFieldType
public Class<?> getFieldType()
Determine theFormatter
-declared field type.- Returns:
- the field type declared in the wrapped
Formatter
implementation (nevernull
) - Throws:
IllegalArgumentException
- if theFormatter
-declared field type cannot be inferred
setAsText
public void setAsText(String text) throws IllegalArgumentException
- Specified by:
setAsText
in interfacePropertyEditor
- Overrides:
setAsText
in classPropertyEditorSupport
- Throws:
IllegalArgumentException
getAsText
public String getAsText()
- Specified by:
getAsText
in interfacePropertyEditor
- Overrides:
getAsText
in classPropertyEditorSupport