public class ResourceArrayPropertyEditor
extends java.beans.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 | Field and Description |
---|---|
private boolean |
ignoreUnresolvablePlaceholders |
private static Log |
logger |
private PropertyResolver |
propertyResolver |
private ResourcePatternResolver |
resourcePatternResolver |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
resolvePath(java.lang.String path)
Resolve the given path, replacing placeholders with
corresponding system property values if necessary.
|
void |
setAsText(java.lang.String text)
Treat the given text as a location pattern and convert it to a Resource array.
|
void |
setValue(java.lang.Object value)
Treat the given value as a collection or array and convert it to a Resource array.
|
private static final Log logger
private final ResourcePatternResolver resourcePatternResolver
private PropertyResolver propertyResolver
private final boolean ignoreUnresolvablePlaceholders
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(java.lang.String text)
setAsText
in interface java.beans.PropertyEditor
setAsText
in class java.beans.PropertyEditorSupport
public void setValue(java.lang.Object value) throws java.lang.IllegalArgumentException
setValue
in interface java.beans.PropertyEditor
setValue
in class java.beans.PropertyEditorSupport
java.lang.IllegalArgumentException
protected java.lang.String resolvePath(java.lang.String path)
path
- the original file pathPropertyResolver.resolvePlaceholders(java.lang.String)
,
PropertyResolver.resolveRequiredPlaceholders(String)