@Target(value={METHOD,FIELD,PARAMETER}) @Retention(value=RUNTIME) @InjectAnnotation public @interface Children
..
" to traverse to a parent resource. Use "./
" to refer to the current resource
itself.
Note: unlike in Child
, one does not specify the precise Sling object to inject but instead
the "parent" object children of which are injected.
You can choose to use only a subset of resource properties used for injection by specifying their common
prefix
and/or postfix
.
Also you can provide one or more references to classes serving as filters for the children/related resources.
These classes must implement Predicate
. (See, e.g., NonNullFilter
).
The underlying Java class member must be an array or else Collection
, List
or
Set
. A member of array/collection must be of type Resource
or else a class that is
adaptable from Resource
or SlingHttpServletRequest
. If the annotated member is a singular
Resource
type or else a singular Sling model type, the first child of a non-empty children collection is
injected. Otherwise, nothing is injected
Child
Modifier and Type | Optional Element and Description |
---|---|
Class<? extends Predicate<org.apache.sling.api.resource.Resource>>[] |
filters
Used to specify filters for the children.
|
String |
name
Used to specify the relative path to the common "parent" of the children that need to be injected.
|
String |
postfix
Used to specify the postfix.
|
String |
prefix
Used to specify the prefix.
|
public abstract Class<? extends Predicate<org.apache.sling.api.resource.Resource>>[] filters
Predicate<Resource>
instances
referred to with their class names. Resources will be probed against these predicates. One possible predicate is
"this resource is not a ghost component", or else "this resource is not null"NonGhostFilter
,
NonNullFilter
public abstract String name
Note: use ./
to consider the current resource as the parent resource
public abstract String postfix
public abstract String prefix
Copyright © 2024 Exadel, Inc.. All rights reserved.