com.gargoylesoftware.base.trace
Class TraceItem

java.lang.Object
  extended by com.gargoylesoftware.base.trace.TraceItem
All Implemented Interfaces:
java.lang.Cloneable

public class TraceItem
extends java.lang.Object
implements java.lang.Cloneable

An item of data to be written.

Version:
$Revision: 1.6 $
Author:
Mike Bowler

Field Summary
private  TraceChannel channel_
           
private  java.lang.Object lock_
           
private  java.lang.String message_
           
private  TraceItem nextItem_
           
private  TraceItem prevItem_
           
private  java.lang.Thread thread_
           
private  java.lang.Throwable throwable_
           
private  java.util.Date time_
           
 
Constructor Summary
TraceItem()
          Create a new item.
 
Method Summary
protected  void assertNotNull(java.lang.String fieldName, java.lang.Object fieldValue)
          Verify that the specified value is not null.
(package private)  void clear()
          Reset all the values to null
 java.lang.Object clone()
          Return a copy of this object.
 boolean containsText()
          Return true if this item contains any text.
 TraceChannel getChannel()
          Return the channel.
 java.lang.Object getLock()
          Return the lock.
 java.lang.String getMessage()
          Return the message.
 TraceItem getNextItem()
          Return the next item.
 TraceItem getPrevItem()
          Return the previous item.
(package private)  java.lang.Thread getThread()
           
 java.lang.String getThreadName()
          Return the name of the thread that called Trace.
 java.lang.Throwable getThrowable()
          Return the throwable.
 java.util.Date getTime()
          Return the time that the item was written to Trace
(package private)  boolean isClear()
           
(package private)  void setChannel(TraceChannel channel)
           
(package private)  void setLock(java.lang.Object lock)
           
(package private)  void setMessage(java.lang.String string)
           
(package private)  void setNextItem(TraceItem item)
           
(package private)  void setPrevItem(TraceItem item)
           
(package private)  void setThread(java.lang.Thread thread)
           
(package private)  void setThrowable(java.lang.Throwable t)
           
(package private)  void setTime(java.util.Date time)
           
 java.lang.String toString()
          Return a string representation of this object for testing purposes.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prevItem_

private TraceItem prevItem_

nextItem_

private TraceItem nextItem_

channel_

private TraceChannel channel_

message_

private java.lang.String message_

throwable_

private java.lang.Throwable throwable_

time_

private java.util.Date time_

thread_

private java.lang.Thread thread_

lock_

private java.lang.Object lock_
Constructor Detail

TraceItem

public TraceItem()
Create a new item.

Method Detail

clear

void clear()
Reset all the values to null


isClear

boolean isClear()
Returns:
true if the message has no content

toString

public java.lang.String toString()
Return a string representation of this object for testing purposes.

Overrides:
toString in class java.lang.Object
Returns:
The string representation

containsText

public boolean containsText()
Return true if this item contains any text.

Returns:
true if this item contains any text.

getMessage

public java.lang.String getMessage()
Return the message.

Returns:
the message.

setMessage

void setMessage(java.lang.String string)
Parameters:
string - The message

getThrowable

public java.lang.Throwable getThrowable()
Return the throwable.

Returns:
the throwable.

setThrowable

void setThrowable(java.lang.Throwable t)
Parameters:
t - The throwable

getTime

public java.util.Date getTime()
Return the time that the item was written to Trace

Returns:
the time.

setTime

void setTime(java.util.Date time)
Parameters:
time - The time

getThread

java.lang.Thread getThread()
Returns:
The thread

setThread

void setThread(java.lang.Thread thread)
Parameters:
thread - The thread

getThreadName

public java.lang.String getThreadName()
Return the name of the thread that called Trace.

Returns:
the name of the thread.

getLock

public java.lang.Object getLock()
Return the lock.

Returns:
the lock.

setLock

void setLock(java.lang.Object lock)
Parameters:
lock - The lock

getPrevItem

public TraceItem getPrevItem()
Return the previous item.

Returns:
the previous item.

setPrevItem

void setPrevItem(TraceItem item)
Parameters:
item - The previous item

getNextItem

public TraceItem getNextItem()
Return the next item.

Returns:
the next item.

setNextItem

void setNextItem(TraceItem item)
Parameters:
item - The next item

getChannel

public TraceChannel getChannel()
Return the channel.

Returns:
the channel.

setChannel

void setChannel(TraceChannel channel)
Parameters:
channel - The channel

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Return a copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
A copy.
Throws:
java.lang.CloneNotSupportedException - If this object is not cloneable.

assertNotNull

protected final void assertNotNull(java.lang.String fieldName,
                                   java.lang.Object fieldValue)
                            throws DetailedNullPointerException
Verify that the specified value is not null. If it is then throw an exception

Parameters:
fieldName - The name of the field to check
fieldValue - The value of the field to check
Throws:
DetailedNullPointerException - If fieldValue is null