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

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, 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()
          Create new ResourceEditor with DefaultResourceLoader.
ResourceEditor(ResourceLoader resourceLoader)
          Create new ResourceEditor with given ResourceLoader.
 
Method Summary
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()
Create new ResourceEditor with DefaultResourceLoader.

See Also:
DefaultResourceLoader

ResourceEditor

public ResourceEditor(ResourceLoader resourceLoader)
Create new ResourceEditor with given ResourceLoader.

Parameters:
resourceLoader - the ResourceLoader to use
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


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