Class ID

java.lang.Object
org.apache.hadoop.mapreduce.ID
All Implemented Interfaces:
Comparable<ID>, Writable, WritableComparable<ID>
Direct Known Subclasses:
ID

@Public @Stable public abstract class ID extends Object implements WritableComparable<ID>
A general identifier, which internally stores the id as an integer. This is the super class of JobID, TaskID and TaskAttemptID.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected static final char
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ID()
     
     
    ID(int id)
    constructs an ID object from the given int
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(ID that)
    Compare IDs by associated numbers
    boolean
     
    int
    returns the int which represents the identifier
    int
     
    void
    Deserialize the fields of this object from in.
     
    void
    Serialize the fields of this object to out.

    Methods inherited from class java.lang.Object

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

    • SEPARATOR

      protected static final char SEPARATOR
      See Also:
    • id

      protected int id
  • Constructor Details

    • ID

      public ID(int id)
      constructs an ID object from the given int
    • ID

      protected ID()
  • Method Details

    • getId

      public int getId()
      returns the int which represents the identifier
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(ID that)
      Compare IDs by associated numbers
      Specified by:
      compareTo in interface Comparable<ID>
    • readFields

      public void readFields(DataInput in) throws IOException
      Description copied from interface: Writable
      Deserialize the fields of this object from in.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Specified by:
      readFields in interface Writable
      Parameters:
      in - DataInput to deseriablize this object from.
      Throws:
      IOException - any other problem for readFields.
    • write

      public void write(DataOutput out) throws IOException
      Description copied from interface: Writable
      Serialize the fields of this object to out.
      Specified by:
      write in interface Writable
      Parameters:
      out - DataOuput to serialize this object into.
      Throws:
      IOException - any other problem for write.