Class AbstractIdentifiable

java.lang.Object
net.okapia.osid.jamocha.spi.AbstractIdentifiable
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
AbstractAdapterIdentifiable, AbstractOsidForm, AbstractOsidNode, AbstractOsidObject

public abstract class AbstractIdentifiable extends Object implements Identifiable
Defines a simple Id based object.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new AbstractIdentifiable.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Sets the current flag to true.
    final boolean
    Determines if the given Id is equal to this one.
    Gets the Id associated with this instance of this OSID object.
    int
    Returns a hash code value for this OsidObject based on the Id.
    boolean
    Tests to see if the last method invoked retrieved up-to-date data.
    protected void
    setId(Id id)
    Sets the Id associated with this instance of this OSID object.
    protected void
    Sets the current flag to false.
    Returns a string representation of this OsidObject.

    Methods inherited from class Object

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

    • AbstractIdentifiable

      public AbstractIdentifiable()
      Constructs a new AbstractIdentifiable.
  • Method Details

    • getId

      @OSID public Id getId()
      Gets the Id associated with this instance of this OSID object.
      Specified by:
      getId in interface Identifiable
      Returns:
      the Id
      Throws:
      IllegalStateException - the Id has not been set
    • setId

      protected void setId(Id id)
      Sets the Id associated with this instance of this OSID object.
      Parameters:
      id - the Id to set
      Throws:
      NullArgumentException - is is null
    • isCurrent

      @OSID public boolean isCurrent()
      Tests to see if the last method invoked retrieved up-to-date data. Simple retrieval methods do not specify errors as, generally, the data is retrieved once at the time this object is instantiated. Some implementations may provide real-time data though the application may not always care. An implementation providing a real-time service may fall back to a previous snapshot in case of error. This method returns false if the data last retrieved was stale.
      Specified by:
      isCurrent in interface Identifiable
      Returns:
      true if the object is up to date, false otherwise
    • current

      protected void current()
      Sets the current flag to true.
    • stale

      protected void stale()
      Sets the current flag to false.
    • equals

      public final boolean equals(Object obj)
      Determines if the given Id is equal to this one. Two Ids are equal if the namespace, authority and identifier components are equal. The identifier is case sensitive while the namespace and authority strings are not case sensitive.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if the given object is equal to this Id, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for this OsidObject based on the Id.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this OsidObject.
      Overrides:
      toString in class Object
      Returns:
      a string