org.jboss.reflect.plugins
Class TypeInfoAttachments

java.lang.Object
  extended by org.jboss.reflect.plugins.TypeInfoAttachments

public class TypeInfoAttachments
extends Object

TypeInfoAttachments. TODO add some security on who can add attachments

Version:
$Revision: 1.1 $
Author:
Adrian Brock

Constructor Summary
TypeInfoAttachments()
           
 
Method Summary
 void addAttachment(String name, Object attachment)
          Set an attachment against the type.
 Object getAttachment(String name)
          Get an attachment from the type
 void removeAttachment(String name)
          Remove an attachment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeInfoAttachments

public TypeInfoAttachments()
Method Detail

addAttachment

public void addAttachment(String name,
                          Object attachment)
Set an attachment against the type. This is useful for caching information against a type.

If you add a future object, subsequent gets will wait for the result

WARNING: Be careful about what you put in here. Don't create references across classloaders, if you are not sure add a WeakReference to the information.

Parameters:
name - the name
attachment - the attachment, pass null to remove an attachment
Throws:
IllegalArgumentException - for a null name

removeAttachment

public void removeAttachment(String name)
Remove an attachment

Parameters:
name - the name
Throws:
IllegalArgumentException - for a null name

getAttachment

public Object getAttachment(String name)
Get an attachment from the type

Parameters:
name - the name
Returns:
the attachment


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