Skip to content

Instantly share code, notes, and snippets.

@mickleroy
Last active November 4, 2024 15:04
Show Gist options
  • Save mickleroy/bf2521648bb900af44f5395f55c1ea5b to your computer and use it in GitHub Desktop.
Save mickleroy/bf2521648bb900af44f5395f55c1ea5b to your computer and use it in GitHub Desktop.
Simple Sling model showing the use of the Exporter framework
@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