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 org. 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.
Resource, ResourceLoader, DefaultResourceLoader, PropertyResolver#resolvePlaceholders
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private PropertyResolver | |
| private final ResourceLoader |
| Access | Constructor and Description |
|---|---|
| public | ResourceEditor()
Create a new instance of the |
| public | ResourceEditor(ResourceLoader
the resourceLoader, PropertyResolver ResourceLoader to usethe propertyResolver)PropertyResolver to useCreate a new instance of the |
| public | ResourceEditor(ResourceLoader
the resourceLoader, PropertyResolver ResourceLoader to usethe propertyResolver, boolean PropertyResolver to usewhether to ignore unresolvable placeholders
if no corresponding property could be found in the given ignoreUnresolvablePlaceholders)propertyResolverCreate a new instance of the |
| Modifier and Type | Method and Description |
|---|---|
| public String | getAsText()
Overrides java. Implements java. |
| protected String | Returns: the resolved file paththe original file path path)Resolve the given path, replacing placeholders with corresponding
property values from the |
| public void | setAsText(String
The string to be parsed. text)Overrides java. Implements java. |
| ignoreUnresolvablePlaceholders | back to summary |
|---|---|
| private final boolean ignoreUnresolvablePlaceholders | |
| propertyResolver | back to summary |
|---|---|
| private PropertyResolver propertyResolver
| |
| resourceLoader | back to summary |
|---|---|
| private final ResourceLoader resourceLoader | |
| ResourceEditor | back to summary |
|---|---|
| public ResourceEditor() Create a new instance of the | |
| ResourceEditor | back to summary |
|---|---|
| public ResourceEditor(ResourceLoader resourceLoader, PropertyResolver propertyResolver) Create a new instance of the
| |
| ResourceEditor | back to summary |
|---|---|
| public ResourceEditor(ResourceLoader resourceLoader, PropertyResolver propertyResolver, boolean ignoreUnresolvablePlaceholders) Create a new instance of the
| |
| getAsText | back to summary |
|---|---|
| public String getAsText() Overrides java. Implements java. Doc from java. Gets the property value as a string suitable for presentation to a human to edit. | |
| resolvePath | back to summary |
|---|---|
| protected String resolvePath(String path) Resolve the given path, replacing placeholders with corresponding
property values from the
| |
| setAsText | back to summary |
|---|---|
| public void setAsText(String text) Overrides java. Implements java. Doc from java. Sets the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text. | |