Spring Framework

org.springframework.beans.propertyeditors
Class URLEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.springframework.beans.propertyeditors.URLEditor
All Implemented Interfaces:
java.beans.PropertyEditor

public class URLEditor
extends java.beans.PropertyEditorSupport

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.

Since:
15.12.2003
Author:
Juergen Hoeller
See Also:
URL, ResourceEditor, ResourceLoader, FileEditor, InputStreamEditor

Constructor Summary
URLEditor()
          Create a new URLEditor, using the default ResourceEditor underneath.
URLEditor(ResourceEditor resourceEditor)
          Create a new URLEditor, using the given ResourceEditor underneath.
 
Method Summary
 java.lang.String getAsText()
           
 void setAsText(java.lang.String text)
           
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLEditor

public URLEditor()
Create a new URLEditor, using the default ResourceEditor underneath.


URLEditor

public URLEditor(ResourceEditor resourceEditor)
Create a new URLEditor, using the given ResourceEditor underneath.

Parameters:
resourceEditor - the ResourceEditor to use
Method Detail

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Specified by:
setAsText in interface java.beans.PropertyEditor
Overrides:
setAsText in class java.beans.PropertyEditorSupport
Throws:
java.lang.IllegalArgumentException

getAsText

public java.lang.String getAsText()
Specified by:
getAsText in interface java.beans.PropertyEditor
Overrides:
getAsText in class java.beans.PropertyEditorSupport

Spring Framework