The Document object
Here we will discuss the document object when using the Java development kit.
Before Reading
This article assumes that you have queried your API and saved the document object in a variable named document.
Copy
document.getId()
Copy
document.getUid()
Copy
document.getType()
Copy
document.getHref()
Copy
document.getTags()
// returns a Set<String>
Copy
document.getFirstPublicationDate()
Copy
document.getLastPublicationDate()
Copy
document.getLang()
Copy
document.getAlternateLanguages()
// returns a list
You can read more about this in the Multi-language page.
To retrieve the content fields from the document you must specify the API ID of the field. Here is an example that retrieves a Date field's content from the document. Here the Date field has the API ID of date.
Copy
// Assuming the document is of the type "page"
document.getDate("page.date").getValue()
Refer to the specific templating documentation for each field to learn how to add content fields to your pages.