Top Description Fields Constructors Methods
org.springframework.beans.propertyeditors

public Class ReaderEditor

extends PropertyEditorSupport
Class Inheritance
Imports
java.beans.PropertyEditorSupport, java.io.IOException, org.springframework.core.io.Resource, .ResourceEditor, org.springframework.core.io.support.EncodedResource, org.springframework.lang.Nullable, org.springframework.util.Assert

One-way PropertyEditor which can convert from a text String to a java.io.Reader, interpreting the given String as a Spring resource location (e.g. a URL String).

Supports Spring-style URL notation: any fully qualified standard URL ("file:", "http:", etc.) and Spring's special "classpath:" pseudo-URL.

Note that such readers usually do not get closed by Spring itself!

Author
Juergen Hoeller
Since
4.2
See Also
java.io.Reader, org.springframework.core.io.ResourceEditor, org.springframework.core.io.ResourceLoader, InputStreamEditor

Field Summary

Modifier and TypeField and Description
private final ResourceEditor

Constructor Summary

AccessConstructor and Description
public
ReaderEditor()

Create a new ReaderEditor, using the default ResourceEditor underneath.

public
ReaderEditor(ResourceEditor
the ResourceEditor to use
resourceEditor
)

Create a new ReaderEditor, using the given ResourceEditor underneath.

Method Summary

Modifier and TypeMethod and Description
public String
getAsText()

Overrides java.beans.PropertyEditorSupport.getAsText.

Implements java.beans.PropertyEditor.getAsText.

This implementation returns null to indicate that there is no appropriate text representation.

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

resourceEditorback to summary
private final ResourceEditor resourceEditor

Constructor Detail

ReaderEditorback to summary
public ReaderEditor()

Create a new ReaderEditor, using the default ResourceEditor underneath.

ReaderEditorback to summary
public ReaderEditor(ResourceEditor resourceEditor)

Create a new ReaderEditor, using the given ResourceEditor underneath.

Parameters
resourceEditor:ResourceEditor

the ResourceEditor to use

Method Detail

getAsTextback to summary
public String getAsText()

Overrides java.beans.PropertyEditorSupport.getAsText.

Implements java.beans.PropertyEditor.getAsText.

This implementation returns null to indicate that there is no appropriate text representation.

Returns:String

Doc from java.beans.PropertyEditorSupport.getAsText.

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
@Nullable
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