This proposal is far from complete, but I was hoping to get a discussion going before I put too much effort into a proof of concept (or proof of failure). The input should help me complete this proposal.

Problem Description

It is currently (HiveMind 1.1 beta 1) quite difficult and cumbersome to provide module descriptors in formats other than XML, e.g. plain Java code. There is of course the Groovy support, but it has a one-to-one correspondance with the XML format, as it is implemented as a thin wrapper (a Builder in Groovy lingua) on top of the XML processing.

The biggest problem is the many constructs in the current API which are specific to the XML syntax. Thus providing a different module descriptor format requires the processing implementation to be expressed in terms of these XML specific constructs. This task is both overly complex and potentially forfeits implementing the processing using constructs better suited to the job.

It is for instance currently not easy to express a module descriptor using plain Java code.

Proposed Solution

The approach of the proposed solution is to move to a more abstract Descriptor API and factor the XML specifics into an XML implementation (based on this API). IMO the following features are XML specific:

The RegistryBuilder part of the Descriptor API has been left out, as it should remain the same.

Ordering of interceptors could also be addressed by letting an implementing object implement the HiveMind Orderable interface.

The getConstructor() methods in ImplementationDef, InterceptorDef, and ContributionDef establish the link to the Runtime API. The returned objects will be used at runtime to lazily instantiate the actual objects. The referenced interfaces are described in the following.

Runtime API

As mentioned the getConstructor() methods on the Extension subtypes establish the link to the Runtime API. Here are the referenced interfaces thereof. Note that the types of the method arguments in these interfaces are the internal interfaces and not the just described Descriptor API interfaces.