org.springframework.core.io
public class: DescriptiveResource [javadoc |
source]
java.lang.Object
org.springframework.core.io.AbstractResource
org.springframework.core.io.DescriptiveResource
All Implemented Interfaces:
Resource
Simple
Resource implementation that holds a resource description
but does not point to an actually readable resource.
To be used as placeholder if a Resource argument is
expected by an API but not necessarily used for actual reading.
- author:
Juergen - Hoeller
- since:
1.2.6 -
| Constructor: |
public DescriptiveResource(String description) {
this.description = (description != null ? description : "");
}
Create a new DescriptiveResource. Parameters:
description - the resource description
|
| Methods from org.springframework.core.io.AbstractResource: |
|---|
|
createRelative, equals, exists, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, hashCode, isOpen, isReadable, lastModified, toString |
| Method from org.springframework.core.io.DescriptiveResource Detail: |
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof DescriptiveResource && ((DescriptiveResource) obj).description.equals(this.description)));
}
This implementation compares the underlying description String. |
public boolean exists() {
return false;
}
|
public String getDescription() {
return this.description;
}
|
public InputStream getInputStream() throws IOException {
throw new FileNotFoundException(
getDescription() + " cannot be opened because it does not point to a readable resource");
}
|
public int hashCode() {
return this.description.hashCode();
}
This implementation returns the hash code of the underlying description String. |
public boolean isReadable() {
return false;
}
|