Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
aanchal-sikka
aanchal-sikkaAccepted solution
Community Advisor
Jan 8, 2025 12:08 PM UTC

Adapters define the behavior and structure that Adaptables are converted to.

 

An Adaptable is an object that can be "adapted" into another type.

  • Purpose: It provides a flexible way to convert an object of one type into another type that may be required in a particular context.

  • Example:

    • Common examples of Adaptables in AEM include:
      • SlingHttpServletRequest
      • Resource
      • Page

 

An Adapter is the target type that an Adaptable can be converted into.

  • Purpose: Adapters are the interfaces or classes into which an Adaptable can be transformed.

  • Example:

    • In AEM, common adapters include:
      • ValueMap
      • ResourceResolver
      • Custom classes implementing specific business logic.

 

 

 

Aanchal Sikka

3 replies

matija_kovacek
New Member
Jan 8, 2025 10:25 AM UTC

Adaptable is source objects that can be adapted, for example Resource.

Adapter is the Target object produced after adaptation, for example, Page.

 

Call .adaptTo(Class) on an Adaptable, where the result of that method is Adapter.

Translate
aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
Jan 8, 2025 12:08 PM UTC

Adapters define the behavior and structure that Adaptables are converted to.

 

An Adaptable is an object that can be "adapted" into another type.

  • Purpose: It provides a flexible way to convert an object of one type into another type that may be required in a particular context.

  • Example:

    • Common examples of Adaptables in AEM include:
      • SlingHttpServletRequest
      • Resource
      • Page

 

An Adapter is the target type that an Adaptable can be converted into.

  • Purpose: Adapters are the interfaces or classes into which an Adaptable can be transformed.

  • Example:

    • In AEM, common adapters include:
      • ValueMap
      • ResourceResolver
      • Custom classes implementing specific business logic.

 

 

 

Translate
Aanchal Sikka
AmitVishwakarma
Community Advisor
Community Advisor
Jan 17, 2025 5:30 PM UTC

In AEM:

  • Adaptables: Objects that can be converted or adapted to another type (e.g., SlingHttpServletRequest, Resource).
  • Adapters: The mechanism or logic that converts an adaptable to a different type (e.g., adapting a Resource to a Sling Model).

Example:

  • Adaptable: SlingHttpServletRequest
  • Adapter: Logic that adapts the request to a model (like a custom Sling Model).

In short: Adaptables are objects that can be adapted; adapters are the logic that performs the adaptation.

Translate
Amit Vishwakarma - Adobe Commerce Champion 2025 | 17x Adobe certified | 6x Adobe SME