...
The InitializableModel
interface has only one, parameterless method: void afterCreated()
. Here's an example use:
Code Block | ||
---|---|---|
| ||
@SliceResource public class ExampleModel implements InitializableModel { private final static Logger LOG = LoggerFactory.getLogger(ExampleModel.class); @JcrProperty private String text; @Override public void afterCreated() { if (text == null) { LOG.warn("There is no text property in the resource"); } } } |
@PreMapping and @PostMapping annotations
Having a model annotated with @SliceResource
you can annotate method with @PreMapping
or @PostMapping
annotation. Such method will be called before or after mapping is done respectively.
Code Block | ||
---|---|---|
| ||
@SliceResource
public class MyComponentModel {
@JcrProperty
private String property;
@Inject
private ModelProvider modelProvider;
@PreMapping
public void preMapping() {
// modelProvider is already set; property is not set
}
@PostMapping
public void postMapping() {
// modelProvider and property are already set
}
} |
How to extend mapper?
Writing your own processor
...