An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Sling specific annotations
### Project information
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jmigac/sling-specific-annotations/Java%20CI%20with%20Maven?style=for-the-badge)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/jmigac/sling-specific-annotations?style=for-the-badge)
[![GitHub license](https://img.shields.io/github/license/jmigac/sling-specific-annotations?style=for-the-badge)](https://github.com/jmigac/additional-graphql-extensions/blob/main/LICENSE)
![Lines of code](https://img.shields.io/tokei/lines/github/jmigac/sling-specific-annotations?style=for-the-badge)

### 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





```