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

public Class URLEditor

extends PropertyEditorSupport
Class Inheritance
Imports
java.beans.PropertyEditorSupport, java.io.IOException, java.net.URL, org.springframework.core.io.Resource, .ResourceEditor, org.springframework.util.Assert

Editor for java.net.URL, to directly populate a URL property instead of using a String property as bridge.

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

Note

A URL must specify a valid protocol, else it will be rejected upfront. However, the target resource does not necessarily have to exist at the time of URL creation; this depends on the specific resource type.

Author
Juergen Hoeller
Since
15.12.2003
See Also
java.net.URL, org.springframework.core.io.ResourceEditor, org.springframework.core.io.ResourceLoader, FileEditor, InputStreamEditor

Field Summary

Modifier and TypeField and Description
private final ResourceEditor

Constructor Summary

AccessConstructor and Description
public
URLEditor()

Create a new URLEditor, using a default ResourceEditor underneath.

public
URLEditor(ResourceEditor
the ResourceEditor to use
resourceEditor
)

Create a new URLEditor, 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.

Gets the property value as a string suitable for presentation to a human to edit.
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

URLEditorback to summary
public URLEditor()

Create a new URLEditor, using a default ResourceEditor underneath.

URLEditorback to summary
public URLEditor(ResourceEditor resourceEditor)

Create a new URLEditor, 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.

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