Annotation Type InterModuleAPI


@Target(TYPE)
@Retention(RUNTIME)
public @interface InterModuleAPI
Marks a class as an "Inter-Module API". Inter-Module APIs can be called from Modules which do not have a compile-time dependency on one another. See ModuleIntegrationService.call(String, String, Object...) for details on how these calls are made.

To create your own Inter-Module API, you should:

  1. Create a java class with a no-args constructor in the "api" subpackage of your base module package. (For example if your base package is com.mycompany.mymodule, the package would be com.mycompany.mymodule.api. Next, annotate the class with @InterModuleAPI("BaseAPIName"), where BaseAPIName is the base name you want to give the API. (For example, you might give a base name of "BookReader", which would then have specific apis like "BookReader.getTitleByISBN" and "BookReader.finishBook".)
  2. Create one or more public methods in the class - these will all be available to callers
Your class will be instantiated by Platform. It may reuse the instance, so statefulness should be avoided. However, Platform will not reuse it across multiple threads, so it need not be threadsafe.

One important consideration when building these APIs will be the types of the parameters and return value. If the module requires or returns classes which are specific to that module, the API will not be useful to a module who doesn't have a compile-type dependency. For that reason, it is recommended (but not enforced) that all arguments and return values be one of:

  • Java primitives and common data types: int, double, String, Date, etc
  • Other commonly understood data types, e.g. JSONObject, JSONArray, etc.
  • Types from platform-api (CsvRow, SqlRow, Table, TimelineView, etc.)
  • Required Element Summary

    Required Elements 
    Modifier and Type Required Element Description
    java.lang.String value
    Base API name
  • Element Details

    • value

      java.lang.String value
      Base API name