-
Notifications
You must be signed in to change notification settings - Fork 0
1.0 Controller Implementation
Anders Mikkelsen edited this page Dec 13, 2017
·
4 revisions
A clean implementation expects two parameters, and accepts two optional parameters.
- The vertx app configuration
- For Redis backed etag storage, the configuration should have a parameter "redis_host", and an optional "redis_port".
- A Repository implementation that is typed to the class use for the RestControllerImpl inheritance
- An optional Function that reads the routingcontext and returns a valid idObject based on the path, this is implemented by the client implementation.
The method postVerifyNotExists method should be overriden to set ids from the path if necessary. E.g. with a DynamoDB implemenation.
You can either extend the controller to do specific overrides like this example:
public class TestModelRESTController extends RestControllerImpl<TestModel> {
public TestModelRESTController(JsonObject appConfig, Repository<TestModel> repository) {
super(TestModel.class, appConfig, repository);
}
}
or use the RestControllerImpl class directly for a standard REST controller (DynamoDBRepository as example):
Repository<TestModel> repository = new DynamoDBRepository<>(TestModel.class, config());
RestControllerImpl<TestModel> = new RestControllerImpl<TestModel>(TestModel.class, config(), repository);