Package com.gargoylesoftware.base.trace
Class TraceChannel
java.lang.Object
com.gargoylesoftware.base.trace.TraceChannel
This class represents a "channel" that diagnostic messages can be written to. The
channel will contain zero or more TraceWriters which will be responsible for handling
the messages.
- Version:
- $Revision: 1.3 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final Stringprivate PropertyChangeSupportprivate final Set -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a property change listener.voidaddTraceWriter(TraceWriter writer) Add a trace writer.protected final voidassertNotNull(String fieldName, Object fieldValue) Verify that the specified value is not null.final StringgetName()Return the name of this trace channel.(package private) SetReturn a collection of trace writersbooleanReturn true if this channel is enabled.voidRemove a property change listener.voidremoveTraceWriter(TraceWriter writer) Remove a trace writer.voidsetEnabled(boolean isEnabled) Set whether or not this channel is enabled.toString()Return a string representation of this object.
-
Field Details
-
name_
-
isEnabled_
private boolean isEnabled_ -
propertyChangeSupport_
-
traceWriters_
-
-
Constructor Details
-
TraceChannel
Create a trace channel with the specified name.- Parameters:
name- The name of the channel.
-
-
Method Details
-
getName
Return the name of this trace channel.- Returns:
- the name.
-
toString
Return a string representation of this object. -
setEnabled
public void setEnabled(boolean isEnabled) Set whether or not this channel is enabled. If it is not enabled then any requests sent to this channel will be discarded.- Parameters:
isEnabled- true if this channel should be enabled.
-
isEnabled
public boolean isEnabled()Return true if this channel is enabled.- Returns:
- true if this channel is enabled.
-
addPropertyChangeListener
Add a property change listener.- Parameters:
listener- The new listener
-
removePropertyChangeListener
Remove a property change listener.- Parameters:
listener- The listener to remove
-
getTraceWriters
Set getTraceWriters()Return a collection of trace writers- Returns:
- The trace writers
-
addTraceWriter
Add a trace writer.- Parameters:
writer- A trace writer
-
removeTraceWriter
Remove a trace writer.- Parameters:
writer- A trace writer
-
assertNotNull
protected final void assertNotNull(String fieldName, 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 checkfieldValue- The value of the field to check- Throws:
DetailedNullPointerException- If fieldValue is null
-