Package org.exoplatform.container
Class AbstractComponentAdapter<T>
- java.lang.Object
-
- org.exoplatform.container.AbstractComponentAdapter<T>
-
- All Implemented Interfaces:
Serializable,ComponentAdapter<T>,ComponentAdapter<T>
- Direct Known Subclasses:
InstanceComponentAdapter,MX4JComponentAdapter
public abstract class AbstractComponentAdapter<T> extends Object implements ComponentAdapter<T>, Serializable
- Version:
- $Id$
- Author:
- Nicolas Filotto
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractComponentAdapter(Object componentKey, Class<T> componentImplementation)Constructs a new ComponentAdapter for the given key and implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckTypeCompatibility()Class<T>getComponentImplementation()Retrieve the class of the component.ObjectgetComponentKey()Retrieve the key associated with the component.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.exoplatform.container.spi.ComponentAdapter
getComponentInstance, isSingleton
-
-
-
-
Constructor Detail
-
AbstractComponentAdapter
protected AbstractComponentAdapter(Object componentKey, Class<T> componentImplementation) throws ContainerException
Constructs a new ComponentAdapter for the given key and implementation.- Parameters:
componentKey- the search key for this implementationcomponentImplementation- the concrete implementation- Throws:
ContainerException- if the key is a type and the implementation cannot be assigned to.
-
-
Method Detail
-
getComponentKey
public Object getComponentKey()
Retrieve the key associated with the component.- Specified by:
getComponentKeyin interfaceComponentAdapter<T>- Specified by:
getComponentKeyin interfaceComponentAdapter<T>- Returns:
- the component's key. Should either be a class type (normally an interface) or an identifier that is unique (within the scope of the current Container).
-
getComponentImplementation
public Class<T> getComponentImplementation()
Retrieve the class of the component.- Specified by:
getComponentImplementationin interfaceComponentAdapter<T>- Specified by:
getComponentImplementationin interfaceComponentAdapter<T>- Returns:
- the component's implementation class. Should normally be a concrete class (ie, a class that can be instantiated).
-
checkTypeCompatibility
protected void checkTypeCompatibility() throws ContainerException- Throws:
ContainerException
-
toString
public String toString()
- Overrides:
toStringin classObject- Returns:
- Returns the ComponentAdapter's class name and the component's key.
- See Also:
Object.toString()
-
-