Skip to content

Instantly share code, notes, and snippets.

@mickleroy
Last active April 28, 2017 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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