...
@PostConstruct methods in a super class will be invoked first.
Using projection, you can inject If the injection should be based on a "child" object JavaBean property of the adaptable. , you can indicate this using the @Via annotation:
Code Block |
|
|
@Model(adaptables=SlingHttpServletRequest.class)
public interface MyModel {
// will return request.getResource().adaptTo(ValueMap.class).get("propertyName", String.class)
@Inject @Projection@Via("resource")
String getPropertyName();
} |
...
- @Model - declares a model class or interface
- @Inject - marks a field or method as injectable
- @Named - declare a name for the injection (otherwise, defaults based on field or method name).
- @Optional - marks a field or method injection as optional
- @Source - explictly tie an injected field or method to a particular injector (by name). Can also be on other annotations.
- @Filter - an OSGi service filter
- @PostConstruct - methods to call upon model option creation (only for model classes)
- @Projection @Via - project use a JavaBean property of the adaptable as the adaptable.source of the injection
- @Default - set default values for a field or method
...