org.jboss.deployers.structure.spi.helpers
Class TrackingMutableAttachments

java.lang.Object
  extended by org.jboss.deployers.structure.spi.helpers.TrackingMutableAttachments
All Implemented Interfaces:
Serializable, Attachments, MutableAttachments

public class TrackingMutableAttachments
extends Object
implements MutableAttachments

TrackingMutableAttachments.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Constructor Summary
TrackingMutableAttachments(MutableAttachments delegate)
          Create a new TrackingMutableAttachments.
 
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.
<T> T
getAttachment(Class<T> type)
          Get attachment
 Object getAttachment(String name)
          Get attachment
<T> T
getAttachment(String name, Class<T> expectedType)
          Get attachment
 Map<String,Object> getAttachments()
          Get all the attachments
 int getChangeCount()
          Get the number of changes that have happened.
 String getCreated(String name)
          Get the deployer that created an attachment
 Set<String> getReferenced(String name)
          Get the deployers that referenced an attachment
 boolean hasAttachments()
          Are there any attachments
 boolean isAttachmentPresent(Class<?> type)
          Is the attachment present
 boolean isAttachmentPresent(String name)
          Is the attachment present
 boolean isAttachmentPresent(String name, Class<?> expectedType)
          Is the attachment present
<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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackingMutableAttachments

public TrackingMutableAttachments(MutableAttachments delegate)
Create a new TrackingMutableAttachments.

Parameters:
delegate - the delegate
Method Detail

getCreated

public String getCreated(String name)
Get the deployer that created an attachment

Parameters:
name - the attachment name
Returns:
the name or null if was predetermined

getReferenced

public Set<String> getReferenced(String name)
Get the deployers that referenced an attachment

Parameters:
name - the attachment name
Returns:
the name or null if nothing referenced it

addAttachment

public <T> T addAttachment(Class<T> type,
                           T attachment)
Description copied from interface: MutableAttachments
Add attachment

Specified by:
addAttachment in interface MutableAttachments
Type Parameters:
T - the expected type
Parameters:
type - the type
attachment - the attachment
Returns:
any previous attachment

addAttachment

public Object addAttachment(String name,
                            Object attachment)
Description copied from interface: MutableAttachments
Add attachment

Specified by:
addAttachment in interface MutableAttachments
Parameters:
name - the name of the attachment
attachment - the attachment
Returns:
any previous attachment

addAttachment

public <T> T addAttachment(String name,
                           T attachment,
                           Class<T> expectedType)
Description copied from interface: MutableAttachments
Add attachment

Specified by:
addAttachment in interface MutableAttachments
Type Parameters:
T - the expected type
Parameters:
name - the name of the attachment
attachment - the attachment
expectedType - the expected type
Returns:
any previous attachment

clear

public void clear()
Description copied from interface: MutableAttachments
Clear the attachments

Specified by:
clear in interface MutableAttachments

clearChangeCount

public void clearChangeCount()
Description copied from interface: MutableAttachments
Reset the change count to zero.

Specified by:
clearChangeCount in interface MutableAttachments

getAttachment

public <T> T getAttachment(Class<T> type)
Description copied from interface: Attachments
Get attachment

Specified by:
getAttachment in interface Attachments
Type Parameters:
T - the expected type
Parameters:
type - the type
Returns:
the attachment or null if not present

getAttachment

public <T> T getAttachment(String name,
                           Class<T> expectedType)
Description copied from interface: Attachments
Get attachment

Specified by:
getAttachment in interface Attachments
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

getAttachment

public Object getAttachment(String name)
Description copied from interface: Attachments
Get attachment

Specified by:
getAttachment in interface Attachments
Parameters:
name - the name of the attachment
Returns:
the attachment or null if not present

getAttachments

public Map<String,Object> getAttachments()
Description copied from interface: Attachments
Get all the attachments

Specified by:
getAttachments in interface Attachments
Returns:
the unmodifiable attachments

getChangeCount

public int getChangeCount()
Description copied from interface: MutableAttachments
Get the number of changes that have happened.

Specified by:
getChangeCount in interface MutableAttachments
Returns:
number of adds/removes that have happened since creation or clearChangeCount.

hasAttachments

public boolean hasAttachments()
Description copied from interface: Attachments
Are there any attachments

Specified by:
hasAttachments in interface Attachments
Returns:
true if there are any attachments, false otherwise.

isAttachmentPresent

public boolean isAttachmentPresent(Class<?> type)
Description copied from interface: Attachments
Is the attachment present

Specified by:
isAttachmentPresent in interface Attachments
Parameters:
type - the type
Returns:
true when the attachment is present

isAttachmentPresent

public boolean isAttachmentPresent(String name,
                                   Class<?> expectedType)
Description copied from interface: Attachments
Is the attachment present

Specified by:
isAttachmentPresent in interface Attachments
Parameters:
name - the name of the attachment
expectedType - the expected type
Returns:
true when the attachment is present

isAttachmentPresent

public boolean isAttachmentPresent(String name)
Description copied from interface: Attachments
Is the attachment present

Specified by:
isAttachmentPresent in interface Attachments
Parameters:
name - the name of the attachment
Returns:
true when the attachment is present

removeAttachment

public <T> T removeAttachment(Class<T> type)
Description copied from interface: MutableAttachments
Remove attachment

Specified by:
removeAttachment in interface MutableAttachments
Type Parameters:
T - the expected type
Parameters:
type - the type
Returns:
the attachment or null if not present

removeAttachment

public <T> T removeAttachment(String name,
                              Class<T> expectedType)
Description copied from interface: MutableAttachments
Remove attachment

Specified by:
removeAttachment in interface MutableAttachments
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

removeAttachment

public Object removeAttachment(String name)
Description copied from interface: MutableAttachments
Remove attachment

Specified by:
removeAttachment in interface MutableAttachments
Parameters:
name - the name of the attachment
Returns:
the attachment or null if not present

setAttachments

public void setAttachments(Map<String,Object> map)
Description copied from interface: MutableAttachments
Set the attachments

Specified by:
setAttachments in interface MutableAttachments
Parameters:
map - the new attachments a map of names to attachments


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