-
-
Save dfparker2002/dd0f64696a318d2f306075c3ba4a9d7e 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