public class Notification extends java.lang.Object implements java.io.Serializable, Message
A valid attribute name must begin with a letter
('a'
-'z'
,
'A'
-'Z'
) or an underscore character
('_'
), and may contain only letters, underscores,
digits ('0'
-'9'
), the dot character
('.'
), the forward slash character
('/'
), and the dollar sign
('$'
). Attribute names must be unique within a
Notification
.
Example:
Notification alert = new Notification();
alert.putAttribute("threat", "virus");
alert.putAttribute("name", "melissa");
alert.putAttribute("total_infected", 25);
alert.putAttribute("os/name", "win32");
alert.putAttribute("os/version", "98");
Constructor and Description |
---|
Notification()
constructs an empty notification.
|
Notification(Notification n)
creates a deep copy of a given notification.
|
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<java.lang.String> |
attributeNamesIterator()
returns an iterator for the set of attribute names of this
notification.
|
void |
clear()
removes every attribute from this notification.
|
AttributeValue |
getAttribute(java.lang.String name)
returns the value of an attribute or
null if
that attribute does not exist in this notification. |
java.util.Iterator<Attribute> |
iterator() |
static Notification |
parseNotification(java.lang.String s) |
void |
putAttribute(java.lang.String name,
AttributeValue value)
set the value of an attribute.
|
void |
putAttribute(java.lang.String name,
boolean value)
set the value of an attribute.
|
void |
putAttribute(java.lang.String name,
byte[] value)
sets the value of an attribute.
|
void |
putAttribute(java.lang.String name,
double value)
set the value of an attribute.
|
void |
putAttribute(java.lang.String name,
long value)
set the value of an attribute.
|
void |
putAttribute(java.lang.String name,
java.lang.String value)
set the value of an attribute.
|
AttributeValue |
removeAttribute(java.lang.String name)
remove an attribute from this notification.
|
int |
size()
returns the number of attributes in this notification.
|
java.lang.String |
toString() |
public Notification()
public Notification(Notification n)
public static Notification parseNotification(java.lang.String s) throws SENPInvalidFormat
SENPInvalidFormat
public java.util.Iterator<Attribute> iterator()
public void putAttribute(java.lang.String name, java.lang.String value)
name
- attribute name.value
- String value.public void putAttribute(java.lang.String name, byte[] value)
name
- attribute name.value
- byte array value.public void putAttribute(java.lang.String name, long value)
name
- attribute name.value
- integer value.public void putAttribute(java.lang.String name, double value)
name
- attribute name.value
- double value.public void putAttribute(java.lang.String name, boolean value)
name
- attribute name.value
- boolean value.public void putAttribute(java.lang.String name, AttributeValue value)
name
- attribute name.value
- value.public AttributeValue getAttribute(java.lang.String name)
null
if
that attribute does not exist in this notification.name
- attribute name.public AttributeValue removeAttribute(java.lang.String name)
name
- attribute name.null
if
the given attribute does not exist in this notification.public int size()
public void clear()
public java.util.Iterator<java.lang.String> attributeNamesIterator()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga