Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.core.io.support
Class ResourceArrayPropertyEditor

    java.lang.Object
      java.beans.PropertyEditorSupport
          org.springframework.core.io.support.ResourceArrayPropertyEditor

All Implemented Interfaces:
  PropertyEditor

    public class ResourceArrayPropertyEditor

extends PropertyEditorSupport

Editor for `Resource` arrays, to automatically convert `String` location patterns (e.g. `"file:C:/my*.txt"` or `"classpath*:myfile.txt"`) to `Resource` array properties. Can also translate a collection or array of location patterns into a merged Resource array.

A path may contain `${...}` placeholders, to be resolved as `Environment` properties: e.g. `${user.dir}`. Unresolvable placeholders are ignored by default.

Delegates to a `ResourcePatternResolver`, by default using a `PathMatchingResourcePatternResolver`.

Since:
  1.1.2
Author:
  Juergen Hoeller, Chris Beams
See Also:
  `Resource`, `ResourcePatternResolver`, `PathMatchingResourcePatternResolver`

Constructor Summary
`ResourceArrayPropertyEditor()` Create a new ResourceArrayPropertyEditor with a default `PathMatchingResourcePatternResolver` and `StandardEnvironment`.
`ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver)` Deprecated. as of 3.1 in favor of `ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver)`
`ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, boolean ignoreUnresolvablePlaceholders)` Deprecated. as of 3.1 in favor of `ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver, boolean)`
`ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, PropertyResolver propertyResolver)` Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and `PropertyResolver` (typically an `Environment`).
`ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, PropertyResolver propertyResolver, boolean ignoreUnresolvablePlaceholders)` Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and `PropertyResolver` (typically an `Environment`).

Method Summary
`protected String` | `resolvePath(String path)` Resolve the given path, replacing placeholders with corresponding system property values if necessary.
`void` | `setAsText(String text)` Treat the given text as a location pattern and convert it to a Resource array.
`void` | `setValue(Object value)` Treat the given value as a collection or array and convert it to a Resource array.

Methods inherited from class java.beans.PropertyEditorSupport
`addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, supportsCustomEditor`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ResourceArrayPropertyEditor

    public ResourceArrayPropertyEditor()

  Create a new ResourceArrayPropertyEditor with a default `PathMatchingResourcePatternResolver` and `StandardEnvironment`.

  See Also:
    `PathMatchingResourcePatternResolver`, `Environment`

### ResourceArrayPropertyEditor

    @Deprecated
    public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver)

  Deprecated. as of 3.1 in favor of `ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver)`

  Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and a `StandardEnvironment`.

  Parameters:
    `resourcePatternResolver` - the ResourcePatternResolver to use

### ResourceArrayPropertyEditor

    public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver,
                                       PropertyResolver propertyResolver)

  Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and `PropertyResolver` (typically an `Environment`).

  Parameters:
    `resourcePatternResolver` - the ResourcePatternResolver to use
    `propertyResolver` - the PropertyResolver to use

### ResourceArrayPropertyEditor

    @Deprecated
    public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver,
                                                  boolean ignoreUnresolvablePlaceholders)

  Deprecated. as of 3.1 in favor of `ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver, boolean)`

  Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and a `StandardEnvironment`.

  Parameters:
    `resourcePatternResolver` - the ResourcePatternResolver to use
    `ignoreUnresolvablePlaceholders` - whether to ignore unresolvable placeholders if no corresponding system property could be found

### ResourceArrayPropertyEditor

    public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver,
                                       PropertyResolver propertyResolver,
                                       boolean ignoreUnresolvablePlaceholders)

  Create a new ResourceArrayPropertyEditor with the given `ResourcePatternResolver` and `PropertyResolver` (typically an `Environment`).

  Parameters:
    `resourcePatternResolver` - the ResourcePatternResolver to use
    `propertyResolver` - the PropertyResolver to use
    `ignoreUnresolvablePlaceholders` - whether to ignore unresolvable placeholders if no corresponding system property could be found

Method Detail

### setAsText

    public void setAsText(String text)

  Treat the given text as a location pattern and convert it to a Resource array.

  Specified by:
    `setAsText` in interface `PropertyEditor`
  Overrides:
    `setAsText` in class `PropertyEditorSupport`

### setValue

    public void setValue(Object value)
                  throws IllegalArgumentException

  Treat the given value as a collection or array and convert it to a Resource array. Considers String elements as location patterns and takes Resource elements as-is.

  Specified by:
    `setValue` in interface `PropertyEditor`
  Overrides:
    `setValue` in class `PropertyEditorSupport`
  Throws:
    `IllegalArgumentException`

### resolvePath

    protected String resolvePath(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:
    `PropertyResolver.resolvePlaceholders(java.lang.String)`, `PropertyResolver.resolveRequiredPlaceholders(String)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD