Top Description Fields Constructors Methods
org.springframework.format.support

public Class FormatterPropertyEditorAdapter

extends PropertyEditorSupport
Class Inheritance
Imports
java.beans.PropertyEditor, .PropertyEditorSupport, org.springframework.context.i18n.LocaleContextHolder, org.springframework.format.Formatter, org.springframework.util.Assert, .StringUtils

Adapter that bridges between Formatter and PropertyEditor.
Author
Juergen Hoeller
Since
4.2

Field Summary

Modifier and TypeField and Description
private final Formatter<Object>

Constructor Summary

AccessConstructor and Description
public
FormatterPropertyEditorAdapter(Formatter<?>
the Formatter to wrap
formatter
)

Create a new FormatterPropertyEditorAdapter for the given Formatter.

Method Summary

Modifier and TypeMethod and Description
public String
getAsText()

Overrides java.beans.PropertyEditorSupport.getAsText.

Implements java.beans.PropertyEditor.getAsText.

Gets the property value as a string suitable for presentation to a human to edit.
public Class<?>

Returns:

the field type declared in the wrapped Formatter implementation (never null)
getFieldType
()

Determine the Formatter-declared field type.

public void
setAsText(String
The string to be parsed.
text
)

Overrides java.beans.PropertyEditorSupport.setAsText.

Implements java.beans.PropertyEditor.setAsText.

Sets the property value by parsing a given String.
Inherited from java.beans.PropertyEditorSupport:
addPropertyChangeListenerfirePropertyChangegetCustomEditorgetJavaInitializationStringgetSourcegetTagsgetValueisPaintablepaintValueremovePropertyChangeListenersetSourcesetValuesupportsCustomEditor

Field Detail

formatterback to summary
private final Formatter<Object> formatter

Constructor Detail

FormatterPropertyEditorAdapterback to summary
public FormatterPropertyEditorAdapter(Formatter<?> formatter)

Create a new FormatterPropertyEditorAdapter for the given Formatter.

Parameters
formatter:Formatter<?>

the Formatter to wrap

Annotations
@SuppressWarnings:unchecked

Method Detail

getAsTextback to summary
public String getAsText()

Overrides java.beans.PropertyEditorSupport.getAsText.

Implements java.beans.PropertyEditor.getAsText.

Doc from java.beans.PropertyEditorSupport.getAsText.

Gets the property value as a string suitable for presentation to a human to edit.

Returns:String

The property value as a string suitable for presentation to a human to edit.

Returns null if the value can't be expressed as a string.

If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().

Annotations
@Override
getFieldTypeback to summary
public Class<?> getFieldType()

Determine the Formatter-declared field type.

Returns:Class<?>

the field type declared in the wrapped Formatter implementation (never null)

Exceptions
IllegalArgumentException:
if the Formatter-declared field type cannot be inferred
setAsTextback to summary
public void setAsText(String text) throws IllegalArgumentException

Overrides java.beans.PropertyEditorSupport.setAsText.

Implements java.beans.PropertyEditor.setAsText.

Doc from java.beans.PropertyEditorSupport.setAsText.

Sets the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.

Parameters
text:String

The string to be parsed.

Annotations
@Override