类 URIEditor
- java.lang.Object
- java.beans.PropertyEditorSupport
- org.springframework.beans.propertyeditors.URIEditor
- 所有已实现的接口:
PropertyEditor
public class URIEditor extends PropertyEditorSupport
Editor forjava.net.URI
, to directly populate a URI property instead of using a String property as bridge.Supports Spring-style URI notation: any fully qualified standard URI ("file:", "http:", etc) and Spring's special "classpath:" pseudo-URL, which will be resolved to a corresponding URI.
By default, this editor will encode Strings into URIs. For instance, a space will be encoded into
%20
. This behavior can be changed by calling theURIEditor(boolean)
constructor.Note: A URI is more relaxed than a URL in that it does not require a valid protocol to be specified. Any scheme within a valid URI syntax is allowed, even without a matching protocol handler being registered.
构造器概要
构造器 构造器 说明 URIEditor()
Create a new, encoding URIEditor, converting "classpath:" locations into standard URIs (not trying to resolve them into physical resources).URIEditor(boolean encode)
Create a new URIEditor, converting "classpath:" locations into standard URIs (not trying to resolve them into physical resources).URIEditor(ClassLoader classLoader)
Create a new URIEditor, using the given ClassLoader to resolve "classpath:" locations into physical resource URLs.URIEditor(ClassLoader classLoader, boolean encode)
Create a new URIEditor, using the given ClassLoader to resolve "classpath:" locations into physical resource URLs.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected URI
createURI(String value)
Create a URI instance for the given user-specified String value.String
getAsText()
void
setAsText(String text)
构造器详细资料
URIEditor
public URIEditor()
Create a new, encoding URIEditor, converting "classpath:" locations into standard URIs (not trying to resolve them into physical resources).
URIEditor
public URIEditor(boolean encode)
Create a new URIEditor, converting "classpath:" locations into standard URIs (not trying to resolve them into physical resources).- 参数:
encode
- indicates whether Strings will be encoded or not- 从以下版本开始:
- 3.0
URIEditor
public URIEditor(ClassLoader classLoader)
Create a new URIEditor, using the given ClassLoader to resolve "classpath:" locations into physical resource URLs.- 参数:
classLoader
- the ClassLoader to use for resolving "classpath:" locations (may benull
to indicate the default ClassLoader)
URIEditor
public URIEditor(ClassLoader classLoader, boolean encode)
Create a new URIEditor, using the given ClassLoader to resolve "classpath:" locations into physical resource URLs.- 参数:
classLoader
- the ClassLoader to use for resolving "classpath:" locations (may benull
to indicate the default ClassLoader)encode
- indicates whether Strings will be encoded or not- 从以下版本开始:
- 3.0
方法详细资料
setAsText
public void setAsText(String text) throws IllegalArgumentException
- 指定者:
setAsText
在接口中PropertyEditor
- 覆盖:
setAsText
在类中PropertyEditorSupport
- 抛出:
IllegalArgumentException
createURI
protected URI createURI(String value) throws URISyntaxException
Create a URI instance for the given user-specified String value.The default implementation encodes the value into a RFC-2396 compliant URI.
- 参数:
value
- the value to convert into a URI instance- 返回:
- the URI instance
- 抛出:
URISyntaxException
- if URI conversion failed
getAsText
public String getAsText()
- 指定者:
getAsText
在接口中PropertyEditor
- 覆盖:
getAsText
在类中PropertyEditorSupport