public final class Watch extends Packet
A Watch is responsible for sending variables and their values to the Console. These key/value pairs will be displayed in the Watches toolbox. If a Watch with the same name is sent twice, the old value is overwritten and the Watches toolbox displays the most current value.
Note: This class is not guaranteed to be thread safe. However, instances of this class will normally only be used in the context of a single thread.
PACKET_HEADER| Constructor and Description |
|---|
Watch()
Overloaded.
|
Watch(WatchType watchType)
Overloaded.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
Returns the name of this Watch.
|
PacketType |
getPacketType()
Overridden.
|
int |
getSize()
Overridden.
|
long |
getTimestamp()
Returns the timestamp of this Watch object.
|
String |
getValue()
Returns the value of this Watch.
|
WatchType |
getWatchType()
Returns the type of this Watch.
|
void |
setName(String name)
Sets the name of this Watch.
|
void |
setTimestamp(long timestamp)
Sets the timestamp of this Watch object.
|
void |
setValue(String value)
Sets the value of this Watch.
|
void |
setWatchType(WatchType watchType)
Sets the type of this Watch.
|
getBytes, getLevel, getStringSize, getThreadId, isThreadSafe, lock, setBytes, setLevel, setThreadSafe, unlockpublic Watch()
public Watch(WatchType watchType)
If the watchType argument is a null reference a NullPointerException will be thrown.
watchType - The type of the new Watch describes the variable type (String,
Integer and so on). Please see the WatchType enum for more
information. Not allowed to be nullNullPointerException - if the watchType argument is nullpublic int getSize()
public PacketType getPacketType()
getPacketType in class Packetpublic String getName()
If a Watch with the same name is sent twice, the old value is overwritten and the Watches toolbox displays the most current value.
This method can return null if this Watch does not contain a name. If this is the case, it will be empty in the SmartInspect Console.
public void setName(String name)
If a Watch with the same name is sent twice, the old value is overwritten and the Watches toolbox displays the most current value. The name of this Watch will be empty in the SmartInspect Console when this method gets a null reference as argument.
name - The new name of this Watch, can be nullpublic String getValue()
public void setValue(String value)
The value of a Watch is always sent as String. To change the type of this variable Watch, please have a look at the setWatchType method.
The value of this Watch will be empty in the SmartInspect Console when this method gets a null reference as argument.
value - The new value of this Watch, can be nullpublic WatchType getWatchType()
public void setWatchType(WatchType watchType)
The type of this Watch describes the variable type (String, Integer and so on). Please see the WatchType enum for more information.
If the watchType argument is a null reference a NullPointerException will be thrown.
watchType - The new type of this Watch. Not allowed to be null.NullPointerException - The watchType argument is null.public long getTimestamp()
public void setTimestamp(long timestamp)
timestamp - The new timestamp of this Watch object. The passed value should
represent the local date and time in microseconds since January
1, 1970. See SmartInspect.now() for more informationCopyright © 2023. All rights reserved.