org.jboss.deployers.spi.attachments
Interface MutableAttachments

All Superinterfaces:
Attachments, Serializable
All Known Subinterfaces:
DeploymentUnit, VFSDeploymentUnit
All Known Implementing Classes:
AbstractDeploymentUnit, AbstractMutableAttachments, AbstractVFSDeploymentUnit, AttachmentsImpl, TrackingMutableAttachments

public interface MutableAttachments
extends Attachments

MutableAttachments.

Version:
$Revision: 1.1 $
Author:
Adrian Brock

Method Summary
<T> T
addAttachment(Class<T> type, T attachment)
          Add attachment
 Object addAttachment(String name, Object attachment)
          Add attachment
<T> T
addAttachment(String name, T attachment, Class<T> expectedType)
          Add attachment
 void clear()
          Clear the attachments
 void clearChangeCount()
          Reset the change count to zero.
 int getChangeCount()
          Get the number of changes that have happened.
<T> T
removeAttachment(Class<T> type)
          Remove attachment
 Object removeAttachment(String name)
          Remove attachment
<T> T
removeAttachment(String name, Class<T> expectedType)
          Remove attachment
 void setAttachments(Map<String,Object> map)
          Set the attachments
 
Methods inherited from interface org.jboss.deployers.spi.attachments.Attachments
getAttachment, getAttachment, getAttachment, getAttachments, hasAttachments, isAttachmentPresent, isAttachmentPresent, isAttachmentPresent
 

Method Detail

addAttachment

Object addAttachment(String name,
                     Object attachment)
Add attachment

Parameters:
name - the name of the attachment
attachment - the attachment
Returns:
any previous attachment
Throws:
IllegalArgumentException - for a null name or attachment
UnsupportedOperationException - when not supported by the implementation

addAttachment

<T> T addAttachment(String name,
                    T attachment,
                    Class<T> expectedType)
Add attachment

Type Parameters:
T - the expected type
Parameters:
name - the name of the attachment
attachment - the attachment
expectedType - the expected type
Returns:
any previous attachment
Throws:
IllegalArgumentException - for a null name, attachment or expectedType
UnsupportedOperationException - when not supported by the implementation

addAttachment

<T> T addAttachment(Class<T> type,
                    T attachment)
Add attachment

Type Parameters:
T - the expected type
Parameters:
attachment - the attachment
type - the type
Returns:
any previous attachment
Throws:
IllegalArgumentException - for a null name, attachment or type
UnsupportedOperationException - when not supported by the implementation

removeAttachment

Object removeAttachment(String name)
Remove attachment

Parameters:
name - the name of the attachment
Returns:
the attachment or null if not present
Throws:
IllegalArgumentException - for a null name
UnsupportedOperationException - when not supported by the implementation

removeAttachment

<T> T removeAttachment(String name,
                       Class<T> expectedType)
Remove attachment

Type Parameters:
T - the expected type
Parameters:
name - the name of the attachment
expectedType - the expected type
Returns:
the attachment or null if not present
Throws:
IllegalArgumentException - for a null name or expectedType
UnsupportedOperationException - when not supported by the implementation

removeAttachment

<T> T removeAttachment(Class<T> type)
Remove attachment

Type Parameters:
T - the expected type
Parameters:
type - the type
Returns:
the attachment or null if not present
Throws:
IllegalArgumentException - for a null name or type

setAttachments

void setAttachments(Map<String,Object> map)
Set the attachments

Parameters:
map - the new attachments a map of names to attachments
Throws:
IllegalArgumentException - for a null map

clear

void clear()
Clear the attachments

Throws:
UnsupportedOperationException - when not supported by the implementation

getChangeCount

int getChangeCount()
Get the number of changes that have happened.

Returns:
number of adds/removes that have happened since creation or clearChangeCount.

clearChangeCount

void clearChangeCount()
Reset the change count to zero.



Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.