org.apache.hadoop.mapred
Class ID

java.lang.Object
  extended by org.apache.hadoop.mapred.ID
All Implemented Interfaces:
Comparable<ID>, Writable, WritableComparable<ID>
Direct Known Subclasses:
JobID, TaskAttemptID, TaskID

public 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:
JobID, TaskID, TaskAttemptID

Field Summary
protected  int id
           
 
Constructor Summary
protected ID()
           
  ID(int id)
          constructs an ID object from the given int
 
Method Summary
 int compareTo(ID that)
          Compare IDs by associated numbers
 boolean equals(Object o)
           
static ID forName(String str)
          Construct an ID object from given string
 int getId()
          returns the int which represents the identifier
 int hashCode()
           
static ID read(DataInput in)
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 String toString()
           
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id
Constructor Detail

ID

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


ID

protected ID()
Method Detail

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

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

read

public static ID read(DataInput in)
               throws IOException
Throws:
IOException

forName

public static ID forName(String str)
                  throws IllegalArgumentException
Construct an ID object from given string

Returns:
constructed Id object or null if the given String is null
Throws:
IllegalArgumentException - if the given string is malformed


Copyright © 2008 The Apache Software Foundation