Implementation

The Core Metamodel module provides a default implementation, GridSystemServiceBootstrap.

An SPI is provided via nested interface FallbackLayoutDataSource, that allows to customize layout fallback behavior on a per class basis. (Without having to override the heavy weight GridSystemServiceBootstrap.)

FallbackLayoutDataSource SPI
interface FallbackLayoutDataSource {
    Try<String> tryLoadAsStringUtf8(Class<?> domainClass); (1)
}
1 Provides custom default for given domainClass or return an Try.empty() if indifferent.

For example:

FallbackLayoutDataSource example
@Service
public class FallbackLayoutForManager implements FallbackLayoutDataSource {

    @Override
    public Try<String> tryLoadAsStringUtf8(final Class<?> domainClass) {
        return domainClass.getSimpleName().endsWith("Manager")
                ? DataSource.ofResource(getClass(), "ManagerLayout.xml") (1)
                    .tryReadAsStringUtf8()
                : Try.empty(); (2)
    }

}
1 Provides a custom layout for all domain classes that have a name ending with 'Manager'.
2 Indifferent for given domain type. Tells the framework to fall through.

(The framework also provides Web UI (Wicket viewer) components that are capable of interpreting and rendering this metadata.