Class FileEditor

  • java.lang.Object
    • java.beans.PropertyEditorSupport
      • org.springframework.beans.propertyeditors.FileEditor
  • All Implemented Interfaces:

    public class FileEditor
    extends java.beans.PropertyEditorSupport
    Editor for, to directly populate a File property from a Spring resource location.

    Supports Spring-style URL notation: any fully qualified standard URL ("file:", "http:", etc) and Spring's special "classpath:" pseudo-URL.

    NOTE: The behavior of this editor has changed in Spring 2.0. Previously, it created a File instance directly from a filename. As of Spring 2.0, it takes a standard Spring resource location as input; this is consistent with URLEditor and InputStreamEditor now.

    NOTE: In Spring 2.5 the following modification was made. If a file name is specified without a URL prefix or without an absolute path then we try to locate the file using standard ResourceLoader semantics. If the file was not found, then a File instance is created assuming the file name refers to a relative file location.

    Juergen Hoeller, Thomas Risberg
    See Also:
    File, ResourceEditor, ResourceLoader, URLEditor, InputStreamEditor
    • Constructor Summary

      Constructor and Description
      Create a new FileEditor, using a default ResourceEditor underneath.
      FileEditor(ResourceEditor resourceEditor)
      Create a new FileEditor, using the given ResourceEditor underneath.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getAsText() 
      void setAsText(java.lang.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

      • FileEditor

        public FileEditor()
        Create a new FileEditor, using a default ResourceEditor underneath.
      • FileEditor

        public FileEditor(ResourceEditor resourceEditor)
        Create a new FileEditor, using the given ResourceEditor underneath.
        resourceEditor - the ResourceEditor to use
    • Method Detail

      • setAsText

        public void setAsText(java.lang.String text)
                       throws java.lang.IllegalArgumentException
        Specified by:
        setAsText in interface java.beans.PropertyEditor
        setAsText in class java.beans.PropertyEditorSupport
      • getAsText

        public java.lang.String getAsText()
        Specified by:
        getAsText in interface java.beans.PropertyEditor
        getAsText in class java.beans.PropertyEditorSupport