Package org.apache.sling.api.adapter
Interface AdapterManager
-
@ProviderType public interface AdapterManagerTheAdapterManagerdefines the service interface for a manager for object adaption. The adapter manager coordinates the registeredAdapterFactoryservices on behalf of clients wishing to adapt objects to other types. One such client is theSlingAdaptableclass, which uses the implementation of this bundle to adapt "itself".Clients may either extend from the
SlingAdaptableclass or access theAdapterManagerservice from the OSGi service registry to adapt objects to other types.This interface is not intended to be implemented by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSERVICE_NAMEThe name under which this service is registered with the OSGi service registry.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <AdapterType>
AdapterTypegetAdapter(@NotNull java.lang.Object adaptable, @NotNull java.lang.Class<AdapterType> type)Returns an adapter object of the requestedAdapterTypefor the givenadaptableobject.
-
-
-
Field Detail
-
SERVICE_NAME
static final java.lang.String SERVICE_NAME
The name under which this service is registered with the OSGi service registry.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAdapter
@Nullable <AdapterType> AdapterType getAdapter(@NotNull @NotNull java.lang.Object adaptable, @NotNull @NotNull java.lang.Class<AdapterType> type)Returns an adapter object of the requestedAdapterTypefor the givenadaptableobject.The
adaptableobject may be any non-nullobject and is not required to implement theAdaptableinterface.- Type Parameters:
AdapterType- The generic type of the adapter (target) type.- Parameters:
adaptable- The object to adapt to the adapter type.type- The type to which the object is to be adapted.- Returns:
- The adapted object or
nullif no factory exists to adapt theadaptableto theAdapterTypeor if theadaptablecannot be adapted for any other reason.
-
-