내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
해결됨

what is difference between adaptables and adapters in aem

Avatar

Level 1

what is difference between adaptables and adapters in aem

주제

토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

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 답변 개

Avatar

Level 1

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.

Avatar

정확한 답변 작성자:
Community Advisor

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

Avatar

Community Advisor

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.