Interface ToolingModelBuilder

  • All Known Subinterfaces:
    ParameterizedToolingModelBuilder<T>

    public interface ToolingModelBuilder
    Responsible for building tooling models to return to the tooling API client.

    The buildAll(String, Project) method is called to create a model for a given project. The model is serialized to the client process and passed to the client application.

    The model object is adapted to the Java type that is used by the client by generating a view, or wrapper object, over the model object. The model object does not need to implement the client Java type, but it does need to have the same structure as the client type. This means that the model object should have the same properties and methods as those defined on the client type. The tooling API deals with missing properties and methods, to allow evolution of the models. It will also adapt the values returned by the methods of the model object to the types used by the client.

    Although it is not enforced, the model object should be immutable, as the tooling API will do some caching and other performance optimizations on the assumption that the model is effectively immutable. The tooling API does not make any guarantees about how the client application will use the model object.

    Plugins can register their own tooling model builder implementations using ToolingModelBuilderRegistry.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object buildAll​(java.lang.String modelName, Project project)
      Creates the model of the given type for the given project.
      boolean canBuild​(java.lang.String modelName)
      Indicates whether this builder can construct the given model.
    • Method Detail

      • canBuild

        boolean canBuild​(java.lang.String modelName)
        Indicates whether this builder can construct the given model.
        Parameters:
        modelName - The model name, usually the same as the name of the Java interface used by the client.
        Returns:
        true if this builder can construct the model, false if not.
      • buildAll

        java.lang.Object buildAll​(java.lang.String modelName,
                                  Project project)
        Creates the model of the given type for the given project.
        Parameters:
        modelName - The model name, usually the same as the name of the Java interface used by the client.
        project - The project to create the model for.
        Returns:
        The model.