https://github.com/jmigac/sling-specific-annotations
Sling specific annotations is a small projects which enables custom annotations for Sling models. Currently it enables @LocalDateValueMapValue and @LocalDateTimeValueMapValue specific injection. Mentioned annotation work on the principle by finding Date object from java.util and transforming it into LocalDate or LocalDateTime object as requested per specific annotations.
https://github.com/jmigac/sling-specific-annotations
adobe-experience-manager aem annotation-processing annotations injection sling
Last synced: 9 months ago
JSON representation
Sling specific annotations is a small projects which enables custom annotations for Sling models. Currently it enables @LocalDateValueMapValue and @LocalDateTimeValueMapValue specific injection. Mentioned annotation work on the principle by finding Date object from java.util and transforming it into LocalDate or LocalDateTime object as requested per specific annotations.
- Host: GitHub
- URL: https://github.com/jmigac/sling-specific-annotations
- Owner: jmigac
- License: mit
- Created: 2022-03-16T06:50:33.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T19:21:56.000Z (about 2 years ago)
- Last Synced: 2025-07-07T00:02:25.597Z (9 months ago)
- Topics: adobe-experience-manager, aem, annotation-processing, annotations, injection, sling
- Language: Java
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sling specific annotations
### Project information


[](https://github.com/jmigac/additional-graphql-extensions/blob/main/LICENSE)

### Maven dependency intro
Sling specific annotations is a small projects which enables custom annotations for Sling models.
Currently it enables `@LocalDateValueMapValue` and `@LocalDateTimeValueMapValue` specific injection. Mentioned annotation work on the principle by finding Date object from java.util and transforming it into LocalDate or LocalDateTime object as requested per specific annotations.
## How to add following project as dependency
```
com.juricamigac
sling-specific-annotations
use the latest version
```
Under repositories add the following code block for repository specification
```
github
https://maven.pkg.github.com/jmigac/sling-specific-annotations
true
true
```
### Additional dependencies which are required to use the following the extension
```
org.osgi
osgi.annotation
7.0.0
biz.aQute.bnd
bndlib
2.4.0
provided
```
### How to use it
As you have injected `Date` object at this time for acquiring Date information in Sling model, with this dependency you can use the following code block to automatically inject `LocalDate` or `LocalDateTime` into Sling models.
```
@LocalDateValueMap
private LocalDate date;
```
```
@LocalDateValueMap(name = "jcr:lastModified", value="node/node2")
private LocalDate date;
```
```
@LocalDateTimeValueMap
private LocalDateTime date;
```
```
@LocalDateTimeValueMap(name = "jcr:lastModified", value="node/node2")
private LocalDatetime date;
```
```
@CurrentPage
private Page page;
```
```
@PageTemplate
private Template template;
```
Annotations `LocalDateValueMapValue` and `LocalDateTimeValueMapValue` have the same properties as ordinary `@ValueMapValue` to inject object with different name or in different structure path.
## Known issues of dependency not getting resolved
If your bundle can't resolve the dependency, there might be a issue that it's not exported to the OSGi, so just import it in your bundle and then expose it to OSGi as shown in the example below.
```
biz.aQute.bnd
bnd-maven-plugin
bnd-process
bnd-process
```