Interface IntentDispatcher


public interface IntentDispatcher

Internal contract between the build-time-generated intent table and the framework. Application code should neither implement nor call this -- declare intents with com.codename1.annotations.AppIntent and, if you need to run one yourself, call Intents.invoke(String, Map).

A single implementation is generated by the Codename One Maven plugin from the AppIntent and IntentEntity annotations in the project and installs itself on Intents during startup. Every call it makes into application code is a direct static invocation emitted at build time: there is no reflection, which is what lets the whole mechanism survive the iOS translator's dead-code elimination and Android's obfuscation.

  • Method Details

    • describe

      List<IntentDeclaration> describe()
      Every intent declared in this application.
    • invoke

      IntentResult invoke(String intentId, Map<String,Object> params, IntentContext ctx)

      Runs one intent. Parameter values arrive as the wire types -- String for entities, which the generated code resolves through the entity's BY_ID query before calling the handler.

      Parameters
      • intentId: the declared intent id
      • params: parameter values keyed by name, never null
      • ctx: the invocation context
      Returns

      the handler's result, or null when no intent has that id

    • queryEntities

      List<AppEntity> queryEntities(String entityType, String kind, String argument)

      Answers an entity query on behalf of the platform, so the system can run its own picker before the handler is called.

      Parameters
      • entityType: the entity type id
      • kind: byId, suggested or search
      • argument: the id for byId, the search text for search, ignored for suggested
      Returns

      the matching entities, empty when the type declares no such query