Last active
November 4, 2024 15:04
-
-
Save mickleroy/bf2521648bb900af44f5395f55c1ea5b to your computer and use it in GitHub Desktop.
Simple Sling model showing the use of the Exporter framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Model( | |
adaptables = Resource.class, | |
resourceType = "acme/components/sling-model" | |
) | |
@Exporter(name = "jackson", extensions = "json") | |
public class MyModel { | |
@Inject @Named("jcr:title") | |
private String title; | |
@Inject @Named("jcr:created") | |
private Calendar createdAt; | |
public String getTitle() { | |
return title; | |
} | |
@JsonIgnore | |
public Calendar getCreatedAt() { | |
return createdAt; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment