com.sleepycat.je.dbi
Class DatabaseId

java.lang.Object
  extended by com.sleepycat.je.dbi.DatabaseId
All Implemented Interfaces:
Loggable, java.lang.Comparable

public class DatabaseId
extends java.lang.Object
implements java.lang.Comparable, Loggable

DatabaseImpl Ids are wrapped in a class so they can be logged.


Constructor Summary
DatabaseId()
          Uninitialized database id, for logging.
DatabaseId(int id)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          see Comparable#compareTo
 void dumpLog(java.lang.StringBuffer sb, boolean verbose)
          Write the object into the string buffer for log dumping.
 boolean equals(java.lang.Object obj)
          Compare two DatabaseImpl Id's.
 byte[] getBytes()
           
 int getId()
           
 int getLogSize()
           
 long getTransactionId()
           
 int hashCode()
           
 void readFromLog(java.nio.ByteBuffer itemBuffer, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
 java.lang.String toString()
           
 void writeToLog(java.nio.ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatabaseId

public DatabaseId(int id)

DatabaseId

public DatabaseId()
Uninitialized database id, for logging.

Method Detail

getId

public int getId()
Returns:
id value

getBytes

public byte[] getBytes()
                throws DatabaseException
Returns:
id as bytes, for use as a key
Throws:
DatabaseException

equals

public boolean equals(java.lang.Object obj)
Compare two DatabaseImpl Id's.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
see Comparable#compareTo

Specified by:
compareTo in interface java.lang.Comparable

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(java.nio.ByteBuffer logBuffer)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Parameters:
logBuffer - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(java.nio.ByteBuffer itemBuffer,
                        byte entryTypeVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, byte)

dumpLog

public void dumpLog(java.lang.StringBuffer sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuffer, boolean)

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()


Copyright 2004,2008 Oracle. All rights reserved.