org.springframework.core.io

## 类 ResourceEditor

- java.lang.Object
- - java.beans.PropertyEditorSupport
  - - org.springframework.core.io.ResourceEditor

- 所有已实现的接口:
    PropertyEditor

      public class ResourceEditor
      extends PropertyEditorSupport

  `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`.

  从以下版本开始:
    28.12.2003
  作者:
    Juergen Hoeller, Dave Syer, Chris Beams
  另请参阅:
    `Resource`, `ResourceLoader`, `DefaultResourceLoader`, `PropertyResolver.resolvePlaceholders(java.lang.String)`

- - ### 构造器概要

    构造器
    构造器和说明
    `ResourceEditor()` Create a new instance of the `ResourceEditor` class using a `DefaultResourceLoader` and `StandardEnvironment`.
    `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`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `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)`

    - ### 从类继承的方法 java.beans.PropertyEditorSupport

      `addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### ResourceEditor

          public ResourceEditor()

      Create a new instance of the `ResourceEditor` class using a `DefaultResourceLoader` and `StandardEnvironment`.

    - #### ResourceEditor

          public ResourceEditor(ResourceLoader resourceLoader,
                                @Nullable
                                PropertyResolver propertyResolver)

      Create a new instance of the `ResourceEditor` class using the given `ResourceLoader` and `PropertyResolver`.
      参数:
        `resourceLoader` - the `ResourceLoader` to use
        `propertyResolver` - the `PropertyResolver` to use

    - #### ResourceEditor

          public ResourceEditor(ResourceLoader resourceLoader,
                                @Nullable
                                PropertyResolver propertyResolver,
                                boolean ignoreUnresolvablePlaceholders)

      Create a new instance of the `ResourceEditor` class using the given `ResourceLoader`.
      参数:
        `resourceLoader` - the `ResourceLoader` to use
        `propertyResolver` - the `PropertyResolver` to use
        `ignoreUnresolvablePlaceholders` - whether to ignore unresolvable placeholders if no corresponding property could be found in the given `propertyResolver`

  - ### 方法详细资料

    - #### setAsText

          public void setAsText(String text)

      指定者:
        `setAsText` 在接口中 `PropertyEditor`
      覆盖:
        `setAsText` 在类中 `PropertyEditorSupport`

    - #### resolvePath

          protected String resolvePath(String path)

      Resolve the given path, replacing placeholders with corresponding property values from the `environment` if necessary.
      参数:
        `path` - the original file path
      返回:
        the resolved file path
      另请参阅:
        `PropertyResolver.resolvePlaceholders(java.lang.String)`, `PropertyResolver.resolveRequiredPlaceholders(java.lang.String)`

    - #### getAsText

          @Nullable
          public String getAsText()

      指定者:
        `getAsText` 在接口中 `PropertyEditor`
      覆盖:
        `getAsText` 在类中 `PropertyEditorSupport`