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
Constructor and Description |
---|
ResourceArrayPropertyEditor()
Create a new ResourceArrayPropertyEditor with a default
PathMatchingResourcePatternResolver and StandardEnvironment . |
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 ). |
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
.PathMatchingResourcePatternResolver
,
Environment
public ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, @Nullable PropertyResolver propertyResolver)
ResourcePatternResolver
and PropertyResolver
(typically an Environment
).resourcePatternResolver
- the ResourcePatternResolver to usepropertyResolver
- the PropertyResolver to usepublic ResourceArrayPropertyEditor(ResourcePatternResolver resourcePatternResolver, @Nullable 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)