Package io.wcm.sling.models.annotations
Annotation Type AemObject
-
@Target({METHOD,FIELD,PARAMETER}) @Retention(RUNTIME) @InjectAnnotation public @interface AemObject
Injects common AEM objects that can be derived from a SlingHttpServletRequest. The injection is class-based, but may be supported by name hints when multiple targets are available for the same class.Supports the following objects:
Supported objects Class Description Name hint Request ResourceResolver Resource PageManagerAEM Page manager X X X PageAEM page addressed by the current request. Default to be injected for Pagetypes.currentPage X X* X PageAEM page containing the current resource. resourcePage X X* X WCMModeCurrent AEM WCM mode X X* X* AuthoringUIModeCurrent AEM Authoring UI mode. Defaults to Touch UI if mode is not set. X X* X* ComponentContextAEM component context of current request X X* X* DesignerAEM designer X X X DesignAEM design of the current page X X* X StyleAEM design style of the current component X X* X* XSSAPIAEM XSS API object for the current request X X* X* I18nI18n object for the current resource/page context. Default to be inejctes for I18ntypes.resourceI18n X X* X* I18nI18n object for the current user userI18n X X* X* TagManagerAEM Tag manager X X X WorkflowSessionGranite Workflow Session X X X In case of X* the class cannot be derived from the adaptable, but is derived from the request of the current thread detected via
RequestContext. If the current thread is not associated with a request nothing is injected.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description org.apache.sling.models.annotations.injectorspecific.InjectionStrategyinjectionStrategyif set to REQUIRED injection is mandatory, if set to OPTIONAL injection is optional, in case of DEFAULT the standard annotations (Optional,Required) are used.StringnameSpecifies the name of the request attribute.booleanoptionalDeprecated.UseinjectionStrategy()instead
-
-
-
Element Detail
-
name
String name
Specifies the name of the request attribute. If empty or not set, then the name is derived from the method or field.For most injections of AemObject this is not required, it is only use as name-hint for injectint a Page object.
- Returns:
- Name
- Default:
- ""
-
-
-
injectionStrategy
org.apache.sling.models.annotations.injectorspecific.InjectionStrategy injectionStrategy
if set to REQUIRED injection is mandatory, if set to OPTIONAL injection is optional, in case of DEFAULT the standard annotations (Optional,Required) are used. If even those are not available the default injection strategy defined on theModelapplies. Default value = DEFAULT.- Returns:
- Injection strategy
- Default:
- org.apache.sling.models.annotations.injectorspecific.InjectionStrategy.DEFAULT
-
-
-
optional
@Deprecated boolean optional
Deprecated.UseinjectionStrategy()insteadIf set to true, the model can be instantiated even if there is no request attribute with the given name found. Default = false.- Returns:
- Optional
- Default:
- false
-
-