站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

ResourceEditor (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.core.io
Class ResourceEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.springframework.core.io.ResourceEditor
All Implemented Interfaces:
PropertyEditor

public class ResourceEditor
extends PropertyEditorSupport

Editor for Resource descriptors, to automatically convert String locations e.g. "file:C:/myfile.txt" or "classpath:myfile.txt") to Resource properties instead of using a String location property.

The path may contain ${...} placeholders, to be resolved as system properties: e.g. ${user.dir}.

Delegates to a ResourceLoader to do the heavy lifting, by default using a DefaultResourceLoader.

Since:
28.12.2003
Author:
Juergen Hoeller
See Also:
Resource, ResourceLoader, DefaultResourceLoader, SystemPropertyUtils.resolvePlaceholders(java.lang.String), System.getProperty(String)

Constructor Summary
ResourceEditor()
          Create a new instance of the ResourceEditor class using a DefaultResourceLoader.
ResourceEditor(ResourceLoader resourceLoader)
          Create a new instance of the ResourceEditor class using the given ResourceLoader.
 
Method Summary
 String getAsText()
           
protected  String resolvePath(String path)
          Resolve the given path, replacing placeholders with corresponding system property values if necessary.
 void setAsText(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

ResourceEditor

public ResourceEditor()
Create a new instance of the ResourceEditor class using a DefaultResourceLoader.


ResourceEditor

public ResourceEditor(ResourceLoader resourceLoader)
Create a new instance of the ResourceEditor class using the given ResourceLoader.

Parameters:
resourceLoader - the ResourceLoader to use
Method Detail

setAsText

public void setAsText(String text)
Specified by:
setAsText in interface PropertyEditor
Overrides:
setAsText in class PropertyEditorSupport

resolvePath

protected String resolvePath(String path)
Resolve the given path, replacing placeholders with corresponding system property values if necessary.

Parameters:
path - the original file path
Returns:
the resolved file path
See Also:
SystemPropertyUtils.resolvePlaceholders(java.lang.String)

getAsText

public String getAsText()
Specified by:
getAsText in interface PropertyEditor
Overrides:
getAsText in class PropertyEditorSupport

The Spring Framework

Copyright © 2002-2007 The Spring Framework.