Endpoints
An Endpoint is a Callable that’s used for general purpose backend logic such as CRUD or a service’s user-facing API.
Creating an Endpoint
To create a Endpoint you write a POJO that extends Endpoint
in service code. The base type is imported from the provided roli-runtime
library.
Endpoint
Contructor Signature
Endpoints require a constructor with a single string
argument, traditionally named key
that must be passed to super.
Key/PrimaryKey
The key in the above example is an opaque string that, together with the type information, uniquely identifies the Endpoint instance at runtime.
Keys are unique to the Endpoint subtype.
After instantiation, the key value can be retrieved from the primaryKey
getter on the Endpoint.
Calling a Endpoint
A client application uses the getEndpoint
RoliClient function to get an endpoint reference at runtime:
The first argument ,MyApiEndpoint
, is your endpoint class that extends Endpoint.
The second argument is the key
.
Each different key
string will result in a different Endpoint instances being referenced.
Automatically Created
Endpoint instances are created automatically (server-side) the first time a method is called on them.