|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.beans.PropertyEditorSupport org.springframework.core.io.ResourceEditor
public class ResourceEditor
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 Environment
properties:
e.g. ${user.dir}
. Unresolvable placeholders are ignored by default.
Delegates to a ResourceLoader
to do the heavy lifting,
by default using a DefaultResourceLoader
.
Resource
,
ResourceLoader
,
DefaultResourceLoader
,
PropertyResolver.resolvePlaceholders(java.lang.String)
Constructor Summary | |
---|---|
ResourceEditor()
Create a new instance of the ResourceEditor class
using a DefaultResourceLoader and StandardEnvironment . |
|
ResourceEditor(ResourceLoader resourceLoader)
Deprecated. as of Spring 3.1 in favor of ResourceEditor(ResourceLoader, PropertyResolver) |
|
ResourceEditor(ResourceLoader resourceLoader,
boolean ignoreUnresolvablePlaceholders)
Deprecated. as of Spring 3.1 in favor of ResourceEditor(ResourceLoader, PropertyResolver, boolean) |
|
ResourceEditor(ResourceLoader resourceLoader,
PropertyResolver propertyResolver)
Create a new instance of the ResourceEditor class
using the given ResourceLoader and PropertyResolver . |
|
ResourceEditor(ResourceLoader resourceLoader,
PropertyResolver propertyResolver,
boolean ignoreUnresolvablePlaceholders)
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 property values from the environment 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 |
---|
public ResourceEditor()
ResourceEditor
class
using a DefaultResourceLoader
and StandardEnvironment
.
@Deprecated public ResourceEditor(ResourceLoader resourceLoader)
ResourceEditor(ResourceLoader, PropertyResolver)
ResourceEditor
class
using the given ResourceLoader
and a StandardEnvironment
.
resourceLoader
- the ResourceLoader
to usepublic ResourceEditor(ResourceLoader resourceLoader, PropertyResolver propertyResolver)
ResourceEditor
class
using the given ResourceLoader
and PropertyResolver
.
resourceLoader
- the ResourceLoader
to usepropertyResolver
- the PropertyResolver
to use@Deprecated public ResourceEditor(ResourceLoader resourceLoader, boolean ignoreUnresolvablePlaceholders)
ResourceEditor(ResourceLoader, PropertyResolver, boolean)
ResourceEditor
class
using the given ResourceLoader
.
resourceLoader
- the ResourceLoader
to useignoreUnresolvablePlaceholders
- whether to ignore unresolvable placeholders
if no corresponding property could be foundpublic ResourceEditor(ResourceLoader resourceLoader, PropertyResolver propertyResolver, boolean ignoreUnresolvablePlaceholders)
ResourceEditor
class
using the given ResourceLoader
.
resourceLoader
- the ResourceLoader
to usepropertyResolver
- the PropertyResolver
to useignoreUnresolvablePlaceholders
- whether to ignore unresolvable placeholders
if no corresponding property could be found in the given propertyResolver
Method Detail |
---|
public void setAsText(String text)
setAsText
in interface PropertyEditor
setAsText
in class PropertyEditorSupport
protected String resolvePath(String path)
environment
if necessary.
path
- the original file path
PropertyResolver.resolvePlaceholders(java.lang.String)
,
PropertyResolver.resolveRequiredPlaceholders(java.lang.String)
public String getAsText()
getAsText
in interface PropertyEditor
getAsText
in class PropertyEditorSupport
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |