com.gargoylesoftware.base.trace

Class TraceItem

public class TraceItem extends Object implements Cloneable

An item of data to be written.

Version: $Revision: 1.4 $

Author: Mike Bowler

Field Summary
TraceChannelchannel_
Objectlock_
Stringmessage_
TraceItemnextItem_
TraceItemprevItem_
Threadthread_
Throwablethrowable_
Datetime_
Constructor Summary
TraceItem()
Create a new item.
Method Summary
protected voidassertNotNull(String fieldName, Object fieldValue)
Verify that the specified value is not null.
voidclear()
Reset all the values to null
Objectclone()
Return a copy of this object.
booleancontainsText()
Return true if this item contains any text.
TraceChannelgetChannel()
Return the channel.
ObjectgetLock()
Return the lock.
StringgetMessage()
Return the message.
TraceItemgetNextItem()
Return the next item.
TraceItemgetPrevItem()
Return the previous item.
ThreadgetThread()
StringgetThreadName()
Return the name of the thread that called Trace.
ThrowablegetThrowable()
Return the throwable.
DategetTime()
Return the time that the item was written to Trace
booleanisClear()
voidsetChannel(TraceChannel channel)
voidsetLock(Object lock)
voidsetMessage(String string)
voidsetNextItem(TraceItem item)
voidsetPrevItem(TraceItem item)
voidsetThread(Thread thread)
voidsetThrowable(Throwable t)
voidsetTime(Date time)
StringtoString()
Return a string representation of this object for testing purposes.

Field Detail

channel_

private TraceChannel channel_

lock_

private Object lock_

message_

private String message_

nextItem_

private TraceItem nextItem_

prevItem_

private TraceItem prevItem_

thread_

private Thread thread_

throwable_

private Throwable throwable_

time_

private Date time_

Constructor Detail

TraceItem

public TraceItem()
Create a new item.

Method Detail

assertNotNull

protected final void assertNotNull(String fieldName, Object fieldValue)
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

clear

void clear()
Reset all the values to null

clone

public Object clone()
Return a copy of this object.

Returns: A copy.

Throws: CloneNotSupportedException If this object is not cloneable.

containsText

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

Returns: true if this item contains any text.

getChannel

public TraceChannel getChannel()
Return the channel.

Returns: the channel.

getLock

public Object getLock()
Return the lock.

Returns: the lock.

getMessage

public String getMessage()
Return the message.

Returns: the message.

getNextItem

public TraceItem getNextItem()
Return the next item.

Returns: the next item.

getPrevItem

public TraceItem getPrevItem()
Return the previous item.

Returns: the previous item.

getThread

Thread getThread()

Returns: The thread

getThreadName

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

Returns: the name of the thread.

getThrowable

public Throwable getThrowable()
Return the throwable.

Returns: the throwable.

getTime

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

Returns: the time.

isClear

boolean isClear()

Returns: true if the message has no content

setChannel

void setChannel(TraceChannel channel)

Parameters: channel The channel

setLock

void setLock(Object lock)

Parameters: lock The lock

setMessage

void setMessage(String string)

Parameters: string The message

setNextItem

void setNextItem(TraceItem item)

Parameters: item The next item

setPrevItem

void setPrevItem(TraceItem item)

Parameters: item The previous item

setThread

void setThread(Thread thread)

Parameters: thread The thread

setThrowable

void setThrowable(Throwable t)

Parameters: t The throwable

setTime

void setTime(Date time)

Parameters: time The time

toString

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

Returns: The string representation