Package com.globalmentor.net
Class AbstractResource
java.lang.Object
com.globalmentor.net.AbstractResource
- All Implemented Interfaces:
Resource
- Direct Known Subclasses:
DefaultResource
,ReferenceResource
Represents an abstract implementation of a resource.
- Author:
- Garret Wilson
-
Field Summary
Fields inherited from interface com.globalmentor.net.Resource
URI_PROPERTY_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
This implementation compares the resource URIs.int
hashCode()
This implementation returns a hashcode value composed from the reference URI, if available.toString()
Returns a string representation of the resource.static String
Returns a reference string representation of the given resource.static String
Returns a reference string representation of the resource identified by the given URI.
-
Constructor Details
-
AbstractResource
public AbstractResource()
-
-
Method Details
-
equals
This implementation compares the resource URIs. If neither object has a reference URI, the default identity comparison is performed. -
hashCode
public int hashCode()This implementation returns a hashcode value composed from the reference URI, if available. -
toString
Returns a reference string representation of the resource identified by the given URI. This version returns the URI between double angle quotation marks.- Parameters:
resourceURI
- The resource URI for which a reference string should be returned.- Returns:
- A reference string representation of the resource.
- Throws:
NullPointerException
- if the given resource URI isnull
.
-
toString
Returns a reference string representation of the given resource. This version returns the URI, if there is one, between double angle quotation marks; otherwise, an ID using the resource's hash code is used.- Parameters:
resource
- The resource for which a reference string should be returned.- Returns:
- A reference string representation of the resource.
- See Also:
-
toString
Returns a string representation of the resource. This version returns the URI, if there is one, between double angle quotation marks; otherwise the default string representation of the object is returned.
-