Package org.apache.sling.api.adapter
Interface Adaptable
-
- All Known Subinterfaces:
Asset,Asset,AssetVersion,Authorizable,BinaryRendition,Blueprint,Blueprint,CarouselSet,ChannelConfig,Component,ConnectorResource,ContentElement,ContentFragment,ContentPolicy,ConverterContext,ElementTemplate,ExperienceFragment,ExperienceFragmentSocialVariation,ExperienceFragmentVariation,FragmentTemplate,Group,ImageSet,MediaSet,Page,Project,ProjectLink,Rendition,Rendition,Resource,ResourceResolver,SlingHttpServletRequest,SlingHttpServletResponse,SlingHttpServletResponseResult,SpinSet,SwatchSet,Tag,Template,TemplatedResource,User,VirtualComponent,WorkflowSession
- All Known Implementing Classes:
AbstractResource,AuthorizableResource,Download,DownloadResource,FilteringResourceWrapper,FormsHandlingRequest,FormsHandlingResponse,GroupResource,Image,ImageResource,JspSlingHttpServletResponseWrapper,MergedMultiResource,NonExistingResource,Paragraph,RedirectRequest,ResourceResolverWrapper,ResourceWrapper,ResponsiveColumn,ResponsiveGrid,SlingAdaptable,SlingAdaptable,SlingHttpServletRequestWrapper,SlingHttpServletResponseWrapper,StringResponseWrapper,SyntheticResource,UserResource,ValueMapResource,ValueMapResourceWrapper,WCMFilteringResourceWrapper
@ConsumerType public interface Adaptable
TheAdaptableinterface identifies objects which can be adapted to other types or representations of the same object. For example a JCR Node basedResourcecan adapt to the underlying JCR Node or a file based resource could adapt to the underlyingjava.io.File.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <AdapterType>
AdapterTypeadaptTo(@NotNull java.lang.Class<AdapterType> type)Adapts the adaptable to another type.
-
-
-
Method Detail
-
adaptTo
@Nullable <AdapterType> AdapterType adaptTo(@NotNull @NotNull java.lang.Class<AdapterType> type)Adapts the adaptable to another type.Please note that it is explicitly left as an implementation detail whether each call to this method with the same
typeyields the same object or a new object on each call.Implementations of this method should document their adapted types as well as their behaviour with respect to returning newly created or same instances on each call.
- Type Parameters:
AdapterType- The generic type to which this object is adapted to- Parameters:
type- The Class object of the target type, such asjavax.jcr.Node.classorjava.io.File.class- Returns:
- The adapter target or
nullif the object cannot adapt to the requested type
-
-