Class AbstractResource

  • All Implemented Interfaces:
    Resource
    Direct Known Subclasses:
    DefaultResource, ReferenceResource

    public abstract class AbstractResource
    extends java.lang.Object
    implements Resource
    Represents an abstract implementation of a resource.
    Author:
    Garret Wilson
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)
      This implementation compares the resource URIs.
      int hashCode()
      This implementation returns a hashcode value composed from the reference URI, if available.
      java.lang.String toString()
      Returns a string representation of the resource.
      static java.lang.String toString​(Resource resource)
      Returns a reference string representation of the given resource.
      static java.lang.String toString​(java.net.URI resourceURI)
      Returns a reference string representation of the resource identified by the given URI.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractResource

        public AbstractResource()
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        This implementation compares the resource URIs. If neither object has a reference URI, the default identity comparison is performed.
        Overrides:
        equals in class java.lang.Object
        See Also:
        Resource.getURI()
      • hashCode

        public int hashCode()
        This implementation returns a hashcode value composed from the reference URI, if available.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public static java.lang.String toString​(java.net.URI resourceURI)
        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:
        java.lang.NullPointerException - if the given resource URI is null.
      • toString

        public static java.lang.String toString​(Resource resource)
        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(URI)
      • toString

        public java.lang.String 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.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the resource.
        See Also:
        toString(Resource)