Skip navigation links
org.netbeans.modules.j2ee.metadata/0 1.52

Java EE Metadata
Under Development

See: Description

Java EE Metadata 
Package Description

This module provides the GenericJavaEEMetadataModelAPI, which is a generic framework for models of Java EE metadata expressed as either XML deployment descriptors or Java annotations. The framework itself doesn't provide access to any specific metadata. Instead, it allows metadata providers to plug in SPI implementations returning whichever kind of metadata they want to provide.

What is New (see all changes)?

Use Cases

Accessing metadata models

A module wishing to access Java EE metadata obtains a metadata model, which is encapsulated by the MetadataModel class. The client then implements a model action, represented by the MetadataModelAction class, and executes this action in the model context by calling the model's runReadAction() method:

    MetadataModel<SomeMetadata> model = // ...
    String result = model.runReadAction(new MetadataModelAction<SomeMetadata, String>() {
        public String run(SomeMetadata metadata) {
            // ... do something with metadata, e.g.
            // compute a String value
            return value;

The way to obtain the model itself, as well as the kinds of metadata encapsulated by MetadataModel is metadata and metadata provider-specific and is not addressed by this API.

Providing metadata models

A metadata provider first defines a root class describing the metadata, e.g., SomeMetadata. Then the provider implements the MetadataModelImplementation interface and creates a MetadataModel using MetadataModelFactory. Then the provider defines a way to return the model to its clients:

    private SomeMetadataModelImplementation modelImpl = new SomeMetadataModelImplementation();
    private MetadataModel<SomeMetadata> model = MetadataModelFactory.createMetadataModel(modelImpl);

     * Call this to retrieve the model of some metadata.
    public MetadataModel<SomeMetadata> getSomeMetadataModel() {
        return model;

    // ... 

    private class SomeMetadataModelImplementation implements MetadataModelImplementation<SomeMetadata> {

        // ...

Providing multiple metadata models

A metadata provider might need to provide several kinds of metadata models at once. Furthermore, since there can be many models available or for backward compatibility reasons it might be impractical to provide a method for each of the models. In this case the provider may define a method like:

    public MetadataModel<T> getMetadataModel(Class<T> clazz) {
        // ...

The types of Class which may be passed to the method is a part of the contract between the provider and its clients.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
GenericJavaEEMetadataModelAPIExportedUnder Developmentindex.html

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans CVS in the j2ee/metadata directory on the merged_model branch.

The default answer to this question is:

The sources for the module are in the Apache Git repositories or in the GitHub repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?


Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.modules.j2ee.metadata/0 1.52