In my java project using DD4T 2 beta, I would like to get the Page Schema object from a page object.
Unfortunately, the Page interface (https://github.com/dd4t/dd4t-2-java/blob/develop/dd4t-api/src/main/java/org/dd4t/contentmodel/Page.java) does not provide a getter for the schema. However, the schema object appears to be available in the page implementation classes, since it inherits from the BaseRepositoryLocalItem (https://github.com/dd4t/dd4t-2-java/blob/b3799b2869de908c05cddd969a0d4fc048448441/dd4t-core/src/main/java/org/dd4t/contentmodel/impl/BaseRepositoryLocalItem.java)
This means that, if i want to access the Schema property, I should cast my Page object to a PageImpl object. Is this the correct way to do it, or is there a better way ?
some sample code
public function getPageSchema(org.dd4t.contentmodel.Page genericPage)
{
// omitted null checks & checks that genericPage is of type PageImpl
Schema pageSchema = ((PageImpl)genericPage).getSchema();
}