org.jboss.soa.esb.message
Interface Attachment


public interface Attachment

Messages may contain attachments that do not appear in the main payload body. For example, binary document formats, zip files etc.
Handles both 'named' attachment and a list of 'unnamed' attachments Eventually attachments will be allowed to have difference encoding properties as they can in the SOAP/Attachments standard.

Author:
Mark Little

Method Summary
 void addItem(java.lang.Object value)
          Appends the specified element to the end of the list of unnamed objects
null values are allowed
 void addItemAt(int index, java.lang.Object value)
          Replaces the element at the specified position in the list of unnamed objects
allows null values
 java.lang.Object get(java.lang.String name)
          Returns the attachment to which this object maps the specified key.
 int getNamedCount()
          getNamedCount()
 java.lang.String[] getNames()
           
 int getUnnamedCount()
          getUnnamedCount()
 java.lang.Object itemAt(int index)
          get the item at the specified position in the list of unnamed objects
 java.lang.Object put(java.lang.String name, java.lang.Object value)
          Associates the specified value with the specified name If there was already a mapping for this name, the old value is replaced by arg1
 java.lang.Object remove(java.lang.String name)
          Removes the mapping for this name if it was present
 java.lang.Object removeItemAt(int index)
          Removes the element at the specified position in the list of unnamed objects Shifts any subsequent elements to the left
 java.lang.Object replaceItemAt(int index, java.lang.Object value)
          Replaces the element at the specified position in the list of unnamed objects with the value supplied
 

Method Detail

get

java.lang.Object get(java.lang.String name)
Returns the attachment to which this object maps the specified key. Returns null if the there's no value mapped for this key.

Parameters:
name - String - The name of the attachment to get
Returns:
Object - the value mapped to arg0 or <null> if none

put

java.lang.Object put(java.lang.String name,
                     java.lang.Object value)
Associates the specified value with the specified name If there was already a mapping for this name, the old value is replaced by arg1

Parameters:
name - String - the name for the object to be stored
value - Object - the object to be associated with the name (arg0)
Returns:
Object - previous value associated with specified name, or null if there was none

remove

java.lang.Object remove(java.lang.String name)
Removes the mapping for this name if it was present

Parameters:
name - String - the name of the object to be removed
Returns:
the value previously associated the name, or null if there was none

getNames

java.lang.String[] getNames()
Returns:
String[] - the list of names of the named Objects

itemAt

java.lang.Object itemAt(int index)
                        throws java.lang.IndexOutOfBoundsException
get the item at the specified position in the list of unnamed objects

Parameters:
index - int - index of element to return
Returns:
Object the element at the specified position in the list of unnamed objects
Throws:
java.lang.IndexOutOfBoundsException - - if the index is out of range

removeItemAt

java.lang.Object removeItemAt(int index)
                              throws java.lang.IndexOutOfBoundsException
Removes the element at the specified position in the list of unnamed objects Shifts any subsequent elements to the left

Parameters:
index - int - index of element to remove
Returns:
Object - the element that was removed from the list
Throws:
java.lang.IndexOutOfBoundsException - - if the index is out of range

replaceItemAt

java.lang.Object replaceItemAt(int index,
                               java.lang.Object value)
                               throws java.lang.IndexOutOfBoundsException
Replaces the element at the specified position in the list of unnamed objects with the value supplied

Parameters:
index - int - index of element to be replaced
value - Object - the object to replace the one previously stored at that index
Returns:
Object - previous value at that index
Throws:
java.lang.IndexOutOfBoundsException - - if the index is out of range

addItem

void addItem(java.lang.Object value)
Appends the specified element to the end of the list of unnamed objects
null values are allowed

Parameters:
value - Object - the object to be appended

addItemAt

void addItemAt(int index,
               java.lang.Object value)
               throws java.lang.IndexOutOfBoundsException
Replaces the element at the specified position in the list of unnamed objects
allows null values

Parameters:
index - int - index where to insert the value - Shifts any subsequent elements to the right
value - Object - value to be stored at the specified position
Throws:
java.lang.IndexOutOfBoundsException

getUnnamedCount

int getUnnamedCount()
getUnnamedCount()

Returns:
the count of unnamed objects

getNamedCount

int getNamedCount()
getNamedCount()

Returns:
the count of named objects