@Documented @Retention(value=RUNTIME) @Target(value={METHOD,ANNOTATION_TYPE}) public @interface AfterMapping
Methods of a ResourceModel with this annotation are invoked after
all properties have been mapped from the model's resource.
If multiple methods are annotated, all of them are executed in no particular order. Inherited annotated
methods are executed as well, though after the execution of the callbacks on the child class.
Example:
@ResourceModelpublic class MyModel { @Thisprivate Resource resource; @AfterMappingpublic void initializeSomethingElse() { // Use the mapped member this.resource.getResourceResolver().resolve(...); //... } @AfterMappingprivate void anotherMethodThatRequiresMappedProperties() throws Exception { ... } }
When an exception arises during the invocation of an after-mapping method, a AfterMapping.ExceptionInAfterMappingMethod will
be thrown. If the method itself is inaccessible - e.g. due to a security manager issue - an IllegalStateException is thrown instead.
Copyright © 2024. All rights reserved.