Notification (Siena 2.0.4 API Documentation)
Date: 2015-05-17

siena

## Class Notification

- java.lang.Object
- - siena.Notification

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<Attribute>, Message

      public class Notification
      extends java.lang.Object
      implements java.io.Serializable, Message

  an event notification The primary data entity used within Siena. A notification is structured as a set of named and typed attributes. Attribute names are strings.

  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");

  See Also:
    `AttributeValue`, `Filter`, `Siena.publish(Notification)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Notification()` constructs an empty notification.
    `Notification(Notification n)` creates a deep copy of a given notification.

  - ### Method Summary

    Methods
    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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Notification

          public Notification()

      constructs an empty notification.

    - #### Notification

          public Notification(Notification n)

      creates a deep copy of a given notification.

  - ### Method Detail

    - #### parseNotification

          public static Notification parseNotification(java.lang.String s)
                                                throws SENPInvalidFormat

      Throws:
        `SENPInvalidFormat`

    - #### iterator

          public java.util.Iterator<Attribute> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<Attribute>`
      Specified by:
        `iterator` in interface `Message`

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          java.lang.String value)

      set the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - String value.

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          byte[] value)

      sets the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - byte array value.

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          long value)

      set the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - integer value.

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          double value)

      set the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - double value.

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          boolean value)

      set the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - boolean value.

    - #### putAttribute

          public void putAttribute(java.lang.String name,
                          AttributeValue value)

      set the value of an attribute. Add the attribute if that is not present.
      Parameters:
        `name` - attribute name.
        `value` - value.

    - #### getAttribute

          public AttributeValue getAttribute(java.lang.String name)

      returns the value of an attribute or `null` if that attribute does not exist in this notification.
      Parameters:
        `name` - attribute name.

    - #### removeAttribute

          public AttributeValue removeAttribute(java.lang.String name)

      remove an attribute from this notification.
      Parameters:
        `name` - attribute name.
      Returns:
        the removed attribute value, or `null` if the given attribute does not exist in this notification.

    - #### size

          public int size()

      returns the number of attributes in this notification.

    - #### clear

          public void clear()

      removes every attribute from this notification.

    - #### attributeNamesIterator

          public java.util.Iterator<java.lang.String> attributeNamesIterator()

      returns an iterator for the set of attribute names of this notification.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2000-2005 University of Colorado.
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga