|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AdapterFactory
The AdapterFactory
interface defines the API for helpers which
may be provided to enhance the adaptability of adaptable objects.
Implementations of this interface are registered as OSGi services and are
used by the AdapterManager
to adapt objects on demand. The
AdapterFactory
services are not really intended to be used by
clients directly.
Field Summary | |
---|---|
static java.lang.String |
ADAPTABLE_CLASSES
The service registration property listing the fully qualified names of classes which can be adapted by this adapter factory (value is "adaptables"). |
static java.lang.String |
ADAPTER_CLASSES
The service registration property listing the fully qualified names of classes to which this factory can adapt adaptables (value is "adapters"). |
static java.lang.String |
SERVICE_NAME
The service name to use when registering implementations of this interface as services (value is "org.apache.sling.osgi.commons.AdapterFactory"). |
Method Summary | ||
---|---|---|
|
getAdapter(java.lang.Object adaptable,
java.lang.Class<AdapterType> type)
Adapt the given object to the adaptable type. |
Field Detail |
---|
static final java.lang.String SERVICE_NAME
static final java.lang.String ADAPTABLE_CLASSES
getAdapter(Object, Class)
method must be an instance of any of
these classes for this factory to be able to adapt the object.
static final java.lang.String ADAPTER_CLASSES
Method Detail |
---|
<AdapterType> AdapterType getAdapter(java.lang.Object adaptable, java.lang.Class<AdapterType> type)
ADAPTABLE_CLASSES
services registration property. The type
parameter is on of the classes listed in the ADAPTER_CLASSES
service registration properties.
This method may return null
if the adaptable object may not
be adapted to the adapter (target) type for any reason. In this case, the
implementation should log a message to the log facility noting the cause
for not being able to adapt.
Note that the adaptable
object is not required to implement
the Adaptable
interface, though most of the time this method
is called by means of calling the Adaptable.adaptTo(Class)
method.
AdapterType
- The generic type of the adapter (target) type.adaptable
- The object to adapt to the adapter type.type
- The type to which the object is to be adapted.
null
if this factory instance
cannot adapt the object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |