Developing Apama Applications > Developing Adapters > Java Codec Plug-in Development > The Java Codec Plug-in Development Specification > Working with normalised events > The NormalisedEvent class
The NormalisedEvent class
The NormalisedEvent class represents a single normalised event. The following methods are provided for examining and modifying the name-value pairs making up the event:
*size - Return the number of elements (name-value pairs) currently stored by the event.
*empty - Check whether the event is empty or not.
*add - Add a new name-value pair to the event. The given name and value will be copied into the event. If an element with the same name already exists, it will not be overwritten. This returns an iterator into the events at the point where the new element was added.
*addQuick - Add a new name-value pair to the event. The given name and value will be copied into the event. If an element with the same name already exists, it will not be overwritten.
*remove - Remove the named element from the normalised event.
*removeAll - Remove all elements from the normalised event. The empty function will return true after this function has been called.
*replace - Change the value of a named element in the normalised event. If an element with the given name already exists, its value will be replaced with a copy of the given value. Otherwise, a new element is created just as though addQuick had been called.
*exists - Check whether a given element exists in the normalised event.
*find - Search for a named element in the normalised event. Returns an iterator into the event at the point where the element was located.
*findValue - Search for a named element in the normalised event and return its value.
*findValueAndRemove - Search for a named element in the normalised event and return its value. If found, the element will also be removed from the event. Returns null if the specified element does not exist or has value null.
*findValueAndRemove2 - Search for a named element in the normalised event and return its value. If found, the element will also be removed from the event. Unlike findValueAndRemove it throws an exception if the value is not found.
*first - Return an iterator pointing to the first element of the normalised event. Successive calls to the next function of the returned iterator will allow you to visit all the elements of the event.
*last - Return an iterator pointing to the last element of the normalised event. Successive calls to the back function of the returned iterator will allow you to visit all the elements of the event.
*toString - Return a printable string representation of the normalised event.
Threading note: Normalised events are not thread-safe. If your code will be accessing the same normalised event object (or associated iterators) from multiple threads, you must implement your own thread synchronization to prevent concurrent modification.
A public zero-argument constructor is provided for creation of new (initially empty) NormalisedEvent objects.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.