Headless Server Developer Manual / Version 2107
Table Of Contents
A query root is the primary object necessary to resolve a GraphQL query. The query root for all content queries
is ContentRoot
. It is created as a Spring Bean in the CaasConfig
class
and provides access to the content repository. A query root does not obey any interfaces or standards. The GraphQL runtime handles a
query root like a POJO using reflection.
At the same time, the Java class ContentRoot
reflects the GraphQL root type in the query
root of the same name. All fields, defined in the GraphQL type correspond to a getter of the same name, for example,
page, which corresponds to the getter public getPage(DataFetchingEnvironment environment)
.
The result of the getter method is the so called root object (not identical to the query root) on which the following
resolving process relies.
On top of the reflection based invocation of the getter methods, CoreMedia added the @fetch
directive, which
allows to use the query root with means of the Spring Expression Language. The Spring EL allows a less
restrictive approach to use the query root or even to invoke completely different objects instead, namely most of
the adapters, that is the SettingsAdapter
, the NavigationAdapter
.