Class AbstractResource

java.lang.Object
com.globalmentor.net.AbstractResource
All Implemented Interfaces:
Resource
Direct Known Subclasses:
DefaultResource, ReferenceResource

public abstract class AbstractResource extends Object implements Resource
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    This implementation compares the resource URIs.
    int
    This implementation returns a hashcode value composed from the reference URI, if available.
    Returns a string representation of the resource.
    static String
    toString(Resource resource)
    Returns a reference string representation of the given resource.
    static String
    toString(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

    Methods inherited from interface com.globalmentor.net.Resource

    getURI
  • Constructor Details

    • AbstractResource

      public AbstractResource()
  • Method Details

    • equals

      public boolean equals(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 Object
      See Also:
    • hashCode

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

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

      public static 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

      public 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 Object
      Returns:
      A string representation of the resource.
      See Also: