org.springframework.core.io
Class ResourceEditor

java.lang.Object
  extended byjava.beans.PropertyEditorSupport
      extended byorg.springframework.core.io.ResourceEditor
All Implemented Interfaces:
java.beans.PropertyEditor
Direct Known Subclasses:
ContextResourceEditor

public class ResourceEditor
extends java.beans.PropertyEditorSupport

Editor for Resource descriptors, to convert String locations to Resource properties automatically 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, by default DefaultResourceLoader.

Since:
28.12.2003
Author:
Juergen Hoeller
See Also:
PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, getResourceLoader(), Resource, ResourceLoader, DefaultResourceLoader, System.getProperty(String)

Field Summary
protected static org.apache.commons.logging.Log logger
           
static java.lang.String PLACEHOLDER_PREFIX
           
static java.lang.String PLACEHOLDER_SUFFIX
           
 
Constructor Summary
ResourceEditor()
           
 
Method Summary
protected  ResourceLoader getResourceLoader()
          Determine the ResourceLoader to use for converting the property text to a Resource.
protected  java.lang.String resolvePath(java.lang.String path)
          Resolve the given path, replacing placeholders with corresponding system property values if necessary.
 void setAsText(java.lang.String text)
           
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setValue, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger

PLACEHOLDER_PREFIX

public static final java.lang.String PLACEHOLDER_PREFIX
See Also:
Constant Field Values

PLACEHOLDER_SUFFIX

public static final java.lang.String PLACEHOLDER_SUFFIX
See Also:
Constant Field Values
Constructor Detail

ResourceEditor

public ResourceEditor()
Method Detail

setAsText

public void setAsText(java.lang.String text)

resolvePath

protected java.lang.String resolvePath(java.lang.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:
PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX

getResourceLoader

protected ResourceLoader getResourceLoader()
Determine the ResourceLoader to use for converting the property text to a Resource. Default is DefaultResourceLoader.

See Also:
DefaultResourceLoader


Copyright (C) 2003-2004 The Spring Framework Project.