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.

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.

Methods

public abstract List<IntentDeclaration> describe()Every intent declared in this application.
public abstract IntentResult invoke(String intentId, Map<String, Object> params, IntentContext ctx)Runs one intent.
public abstract 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.

Method details

describe

public abstract List<IntentDeclaration> describe()
Every intent declared in this application.

invoke

public abstract 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 String
the declared intent id
params Map<String, Object>
parameter values keyed by name, never null
ctx IntentContext
the invocation context

Returns

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

queryEntities

public abstract 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 String
the entity type id
kind String
byId, suggested or search
argument String
the id for byId, the search text for search, ignored for suggested

Returns

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