Class MockAdapterManagerImpl
java.lang.Object
org.apache.sling.testing.mock.sling.MockAdapterManagerImpl
- All Implemented Interfaces:
org.apache.sling.api.adapter.AdapterManager
public class MockAdapterManagerImpl
extends Object
implements org.apache.sling.api.adapter.AdapterManager
This is a copy of org.apache.sling.adapter.internal.AdpaterManagerImpl from Sling Adapter 2.1.6,
with all calls to SyntheticResource.setAdapterManager/unsetAdapterManager disabled, because this would
break the
ThreadsafeMockAdapterManagerWrapper concept.
Additionally the reference to PackageAdmin is disabled.-
Field Summary
Fields inherited from interface org.apache.sling.api.adapter.AdapterManager
SERVICE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate(org.osgi.service.component.ComponentContext context) Activate the manager.protected voidbindAdapterFactory(org.osgi.framework.ServiceReference<org.apache.sling.api.adapter.AdapterFactory> reference) Bind a new adapter factory.protected voiddeactivate(org.osgi.service.component.ComponentContext context) Deactivate<AdapterType>
AdapterTypegetAdapter(@NotNull Object adaptable, @NotNull Class<AdapterType> type) Returns the adaptedadaptableornullif the object cannot be adapted.protected voidunbindAdapterFactory(org.osgi.framework.ServiceReference<org.apache.sling.api.adapter.AdapterFactory> reference) Unbind a adapter factory.
-
Constructor Details
-
MockAdapterManagerImpl
public MockAdapterManagerImpl()
-
-
Method Details
-
getAdapter
public <AdapterType> AdapterType getAdapter(@NotNull @NotNull Object adaptable, @NotNull @NotNull Class<AdapterType> type) Returns the adaptedadaptableornullif the object cannot be adapted.- Specified by:
getAdapterin interfaceorg.apache.sling.api.adapter.AdapterManager- See Also:
-
AdapterManager.getAdapter(java.lang.Object, java.lang.Class)
-
activate
protected void activate(org.osgi.service.component.ComponentContext context) Activate the manager. Bind all already registered factories- Parameters:
context- Component context
-
deactivate
protected void deactivate(org.osgi.service.component.ComponentContext context) Deactivate- Parameters:
context- Not used
-
bindAdapterFactory
protected void bindAdapterFactory(org.osgi.framework.ServiceReference<org.apache.sling.api.adapter.AdapterFactory> reference) Bind a new adapter factory.- Parameters:
reference- Service reference
-
unbindAdapterFactory
protected void unbindAdapterFactory(org.osgi.framework.ServiceReference<org.apache.sling.api.adapter.AdapterFactory> reference) Unbind a adapter factory.- Parameters:
reference- Service reference
-