public class ResourceArrayPropertyEditor extends PropertyEditorSupport
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
.
Resource
,
ResourcePatternResolver
,
PathMatchingResourcePatternResolver
Modifier and Type | Method and Description |
---|---|
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.
|
addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, supportsCustomEditor
public ResourceArrayPropertyEditor()
PathMatchingResourcePatternResolver
and StandardEnvironment
.@Deprecated public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver)
ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver)
ResourcePatternResolver
and a StandardEnvironment
.resourcePatternResolver
- the ResourcePatternResolver to use@Deprecated public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, boolean ignoreUnresolvablePlaceholders)
ResourceArrayPropertyEditor(ResourcePatternResolver, PropertyResolver, boolean)
ResourcePatternResolver
and a StandardEnvironment
.resourcePatternResolver
- the ResourcePatternResolver to useignoreUnresolvablePlaceholders
- whether to ignore unresolvable placeholders
if no corresponding system property could be foundpublic ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, PropertyResolver propertyResolver)
ResourcePatternResolver
and PropertyResolver
(typically an Environment
).resourcePatternResolver
- the ResourcePatternResolver to usepropertyResolver
- the PropertyResolver to usepublic ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, PropertyResolver propertyResolver, boolean ignoreUnresolvablePlaceholders)
ResourcePatternResolver
and PropertyResolver
(typically an Environment
).resourcePatternResolver
- the ResourcePatternResolver to usepropertyResolver
- the PropertyResolver to useignoreUnresolvablePlaceholders
- whether to ignore unresolvable placeholders
if no corresponding system property could be foundpublic void setAsText(String text)
setAsText
in interface PropertyEditor
setAsText
in class PropertyEditorSupport
public void setValue(Object value) throws IllegalArgumentException
setValue
in interface PropertyEditor
setValue
in class PropertyEditorSupport
IllegalArgumentException
protected String resolvePath(String path)
path
- the original file pathPropertyResolver.resolvePlaceholders(java.lang.String)
,
PropertyResolver.resolveRequiredPlaceholders(String)