javax.management
public class Notification extends EventObject
A notification message that may be emitted by a bean. Notifications have both a message and a type, so individual notifications can be grouped by type. They also incorporate sequencing, so that the recipient can order the delivered messages correctly (there is no guarantee that they will be delivered in order).
Notifications also include a reference to the source of
the notification. The source bean is represented either
by an ObjectName
or by a direct reference to the
bean. The former is preferable, and notifications emitted
via a MBeanServer
will automatically have the source
transformed into an ObjectName
.
Modifier and Type | Field and Description |
---|---|
protected Object |
source
The source of the notification.
|
Constructor and Description |
---|
Notification(String type,
Object source,
long sequenceNumber)
Creates a new
Notification object with the specified type,
source and sequence number. |
Notification(String type,
Object source,
long sequenceNumber,
long timeStamp)
Creates a new
Notification object with the specified type,
source, sequence number and timestamp. |
Notification(String type,
Object source,
long sequenceNumber,
long timeStamp,
String message)
Creates a new
Notification object with the specified type,
source, sequence number, timestamp and message. |
Notification(String type,
Object source,
long sequenceNumber,
String message)
Creates a new
Notification object with the specified type,
source, sequence number and message. |
Modifier and Type | Method and Description |
---|---|
String |
getMessage()
Returns the message contained in this notification.
|
long |
getSequenceNumber()
Returns the sequence number of this notification.
|
long |
getTimeStamp()
Returns the date and time at which this notification was
emitted.
|
String |
getType()
Returns the type of this notification.
|
Object |
getUserData()
Returns the additional user data associated with the notification.
|
void |
setSequenceNumber(long sequenceNumber)
Sets the sequence number to the value specified.
|
void |
setSource(Object source)
Sets the source of this notification to the value
specified.
|
void |
setTimeStamp(long timeStamp)
Sets the date and time at which this notification
was emitted.
|
void |
setUserData(Object userData)
Sets the additional user data associated with the notification
to the specified value.
|
String |
toString()
A textual representation of the notification.
|
getSource
protected Object source
source
variable in EventObject
with a non-transient version.public Notification(String type, Object source, long sequenceNumber)
Notification
object with the specified type,
source and sequence number. The timestamp is created using the
current date and time.type
- the type of the notification.source
- the source of the notification.sequenceNumber
- the sequence number of the notifcation.public Notification(String type, Object source, long sequenceNumber, long timeStamp)
Notification
object with the specified type,
source, sequence number and timestamp.type
- the type of the notification.source
- the source of the notification.sequenceNumber
- the sequence number of the notifcation.timeStamp
- the time the notification was emitted.public Notification(String type, Object source, long sequenceNumber, long timeStamp, String message)
Notification
object with the specified type,
source, sequence number, timestamp and message.type
- the type of the notification.source
- the source of the notification.sequenceNumber
- the sequence number of the notifcation.timeStamp
- the time the notification was emitted.message
- the message contained in the notification.public Notification(String type, Object source, long sequenceNumber, String message)
Notification
object with the specified type,
source, sequence number and message. The timestamp is created using
the current date and time.type
- the type of the notification.source
- the source of the notification.sequenceNumber
- the sequence number of the notifcation.message
- the message contained in the notification.public String getMessage()
String
form, and is thus intended for
display to the end-user. Data transferred as part of the notification
which shouldn't be displayed is included in the userData
field.getUserData()
,
setUserData(java.lang.Object)
public long getSequenceNumber()
setSequenceNumber(long)
public long getTimeStamp()
setTimeStamp(long)
public String getType()
public Object getUserData()
setUserData(java.lang.Object)
public void setSequenceNumber(long sequenceNumber)
sequenceNumber
- the new sequence number.getSequenceNumber()
public void setSource(Object source)
source
- the new source of the notification.java.util.EventSource#getSource()
public void setTimeStamp(long timeStamp)
timeStamp
- the new time stamp of the notification.getTimeStamp()
public void setUserData(Object userData)
userData
- the new user data associated with the notification.getUserData()
public String toString()
toString
in class EventObject
String
form.Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)