org.springframework.beans.propertyeditors

Class PathEditor

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


    public class PathEditor
    extends java.beans.PropertyEditorSupport
    Editor for java.nio.file.Path, to directly populate a Path property instead of using a String property as bridge.

    Based on Paths.get(URI)'s resolution algorithm, checking registered NIO file system providers, including the default file system for "file:..." paths. Also supports Spring-style URL notation: any fully qualified standard URL and Spring's special "classpath:" pseudo-URL, as well as Spring's context-specific relative file paths. As a fallback, a path will be resolved in the file system via Paths#get(String) if no existing context-relative resource could be found.

    Since:
    4.3.2
    Author:
    Juergen Hoeller
    See Also:
    Path, Paths.get(URI), ResourceEditor, ResourceLoader, FileEditor, URLEditor
    • Constructor Summary

      Constructors 
      Constructor and Description
      PathEditor()
      Create a new PathEditor, using the default ResourceEditor underneath.
      PathEditor(ResourceEditor resourceEditor)
      Create a new PathEditor, 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

      • PathEditor

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

        public PathEditor(ResourceEditor resourceEditor)
        Create a new PathEditor, using the given ResourceEditor underneath.
        Parameters:
        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
        Overrides:
        setAsText in class java.beans.PropertyEditorSupport
        Throws:
        java.lang.IllegalArgumentException
      • getAsText

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