com.sun.xml.ws.message
Class AttachmentSetImpl

java.lang.Object
  extended by com.sun.xml.ws.message.AttachmentSetImpl
All Implemented Interfaces:
AttachmentSet, Iterable<Attachment>

public final class AttachmentSetImpl
extends Object
implements AttachmentSet

Default dumb AttachmentSet implementation backed by ArrayList.

The assumption here is that the number of attachments are small enough to justify linear search in get(String).


Constructor Summary
AttachmentSetImpl()
          Creates an empty AttachmentSet.
AttachmentSetImpl(Iterable<Attachment> base)
          Creates an AttachmentSet by copying contents from another.
 
Method Summary
 void add(Attachment att)
          Adds an attachment to this set.
 Attachment get(String contentId)
          Gets the attachment by the content ID.
 boolean isEmpty()
          Returns true if there's no attachment.
 Iterator<Attachment> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentSetImpl

public AttachmentSetImpl()
Creates an empty AttachmentSet.


AttachmentSetImpl

public AttachmentSetImpl(Iterable<Attachment> base)
Creates an AttachmentSet by copying contents from another.

Method Detail

get

public Attachment get(String contentId)
Description copied from interface: AttachmentSet
Gets the attachment by the content ID.

Specified by:
get in interface AttachmentSet
Parameters:
contentId - The content ID like "foo-bar-zot@abc.com", without surrounding '<' and '>' used as the transfer syntax.
Returns:
null if no such attachment exist.

isEmpty

public boolean isEmpty()
Description copied from interface: AttachmentSet
Returns true if there's no attachment.

Specified by:
isEmpty in interface AttachmentSet

add

public void add(Attachment att)
Description copied from interface: AttachmentSet
Adds an attachment to this set.

Note that it's OK for an Attachment to belong to more than one AttachmentSet (which is in fact necessary when you wrap a Message into another.

Specified by:
add in interface AttachmentSet
Parameters:
att - must not be null.

iterator

public Iterator<Attachment> iterator()
Specified by:
iterator in interface Iterable<Attachment>