org.ow2.easybeans.api
Interface EZBExtensor

All Known Subinterfaces:
EZBContainer

public interface EZBExtensor

The EZBExtensor interface aims to provide a way to add objects to instances, thus providing an extension mechanism.

Author:
Guillaume Sauthier

Method Summary
<T> T
addExtension(Class<T> clazz, T extension)
          Add a new extension under a given Class key.
<T> T
getExtension(Class<T> clazz)
          Return an extension implementing the given class/interface.
<T> T
removeExtension(Class<T> clazz)
          Remove the registered extension, if one was previously registered.
 

Method Detail

addExtension

<T> T addExtension(Class<T> clazz,
                   T extension)
Add a new extension under a given Class key. Previously registed extension (if there was one) is replaced by the new one. The old extension is returned.

Type Parameters:
T - Extension type.
Parameters:
clazz - Extenstion type
extension - the extension to add

removeExtension

<T> T removeExtension(Class<T> clazz)
Remove the registered extension, if one was previously registered. After a call to that method, the getExtension will return null for the removed type.

Type Parameters:
T - Extension type
Parameters:
clazz - Extension type to be removed (this is the key)
Returns:
the removed Extension.

getExtension

<T> T getExtension(Class<T> clazz)
Return an extension implementing the given class/interface. May return null if no extension was registered under the given class name.

Type Parameters:
T - Extension type
Parameters:
clazz - The key used to retrieve the extension.
Returns:
The found extension, or null if none was found.


Copyright © 2006-2012 OW2 Consortium. All Rights Reserved.