GridLoaderService

Provides the ability to load the XML layout (grid) for a domain class.

API

GridLoaderService.java
interface GridLoaderService {
  boolean supportsReloading()     (1)
  void remove(Class<?> domainClass)     (2)
  boolean existsFor(Class<?> domainClass, EnumSet<CommonMimeType> supportedFormats)     (3)
  Optional<T> load(Class<?> domainClass, String layoutIfAny, GridMarshallerService<T> marshaller)     (4)
  Optional<T> load(Class<?> domainClass, GridMarshallerService<T> marshaller)     (5)
}
1 supportsReloading()

Whether dynamic reloading of layouts is enabled.

2 remove(Class)

To support metamodel invalidation/rebuilding of spec.

3 existsFor(Class, EnumSet)

Whether any persisted layout metadata (eg a .layout.xml file) exists for this domain class.

4 load(Class, String, GridMarshallerService)

Optionally returns a new instance of a Grid , based on whether the underlying resource could be found, loaded and parsed.

5 load(Class, GridMarshallerService)

Optionally returns a new instance of a Grid , based on whether the underlying resource could be found, loaded and parsed.

Members

supportsReloading()

Whether dynamic reloading of layouts is enabled.

The default implementation enables reloading for prototyping mode, disables in production

remove(Class)

To support metamodel invalidation/rebuilding of spec.

This is called by the Object_rebuildMetamodel mixin action.

existsFor(Class, EnumSet)

Whether any persisted layout metadata (eg a .layout.xml file) exists for this domain class.

If none exists, will return null (and the calling GridService will use GridSystemService to obtain a default grid for the domain class).

load(Class, String, GridMarshallerService)

Optionally returns a new instance of a Grid , based on whether the underlying resource could be found, loaded and parsed.

The layout alternative will typically be specified through a layout() method on the domain object, the value of which is used for the suffix of the layout file (eg "Customer-layout.archived.xml" to use a different layout for customers that have been archived).

load(Class, GridMarshallerService)

Optionally returns a new instance of a Grid , based on whether the underlying resource could be found, loaded and parsed.

Implementation

The framework provides a default implementation of this service, namely GridLoaderServiceDefault. This implementation loads the grid from its serialized representation as a .layout.xml file, loaded from the classpath.

For example, the layout for a domain class com.mycompany.myapp.Customer would be loaded from com/mycompany/myapp/Customer.layout.xml.

See also

Related services: