use of com.linkedin.restli.internal.server.methods.arguments.CreateArgumentBuilder in project rest.li by linkedin.
the class MethodAdapterRegistry method buildAdapterRegistry.
private Map<ResourceMethod, RestLiArgumentBuilder> buildAdapterRegistry() {
Map<ResourceMethod, RestLiArgumentBuilder> result = new HashMap<ResourceMethod, RestLiArgumentBuilder>(ResourceMethod.values().length);
result.put(ResourceMethod.GET, new GetArgumentBuilder());
result.put(ResourceMethod.BATCH_GET, new BatchGetArgumentBuilder());
result.put(ResourceMethod.FINDER, new CollectionArgumentBuilder());
result.put(ResourceMethod.CREATE, new CreateArgumentBuilder());
result.put(ResourceMethod.PARTIAL_UPDATE, new PatchArgumentBuilder());
result.put(ResourceMethod.UPDATE, new UpdateArgumentBuilder());
result.put(ResourceMethod.DELETE, new GetArgumentBuilder());
result.put(ResourceMethod.ACTION, new ActionArgumentBuilder());
result.put(ResourceMethod.BATCH_UPDATE, new BatchUpdateArgumentBuilder());
result.put(ResourceMethod.BATCH_PARTIAL_UPDATE, new BatchPatchArgumentBuilder());
result.put(ResourceMethod.BATCH_CREATE, new BatchCreateArgumentBuilder());
result.put(ResourceMethod.BATCH_DELETE, new BatchDeleteArgumentBuilder());
result.put(ResourceMethod.GET_ALL, new CollectionArgumentBuilder());
return Collections.unmodifiableMap(result);
}
use of com.linkedin.restli.internal.server.methods.arguments.CreateArgumentBuilder in project rest.li by linkedin.
the class TestCustomMethodAdapterProvider method initClass.
@BeforeClass
public void initClass() throws Exception {
RestLiConfig config = new RestLiConfig();
config.setMethodAdapterProvider(new DefaultMethodAdapterProvider(new ErrorResponseBuilder(ErrorResponseFormat.MESSAGE_AND_SERVICECODE)) {
@Override
public RestLiArgumentBuilder getArgumentBuilder(ResourceMethod resourceMethod) {
// Override the behavior of the CREATE argument builder
if (resourceMethod == ResourceMethod.CREATE) {
return new CreateArgumentBuilder() {
@Override
public RestLiRequestData extractRequestData(RoutingResult routingResult, DataMap dataMap) {
// Always use the FRIENDLY record regardless of the actual data
return new RestLiRequestDataImpl.Builder().entity(FRIENDLY).build();
}
};
} else {
return super.getArgumentBuilder(resourceMethod);
}
}
});
super.init(false, config);
}
use of com.linkedin.restli.internal.server.methods.arguments.CreateArgumentBuilder in project rest.li by linkedin.
the class DefaultMethodAdapterProvider method buildAdapterRegistry.
private Map<ResourceMethod, RestLiArgumentBuilder> buildAdapterRegistry() {
Map<ResourceMethod, RestLiArgumentBuilder> result = new HashMap<>(ResourceMethod.values().length);
result.put(ResourceMethod.GET, new GetArgumentBuilder());
result.put(ResourceMethod.BATCH_GET, new BatchGetArgumentBuilder());
result.put(ResourceMethod.FINDER, new CollectionArgumentBuilder());
result.put(ResourceMethod.BATCH_FINDER, new CollectionArgumentBuilder());
result.put(ResourceMethod.CREATE, new CreateArgumentBuilder());
result.put(ResourceMethod.PARTIAL_UPDATE, new PatchArgumentBuilder());
result.put(ResourceMethod.UPDATE, new UpdateArgumentBuilder());
result.put(ResourceMethod.DELETE, new GetArgumentBuilder());
result.put(ResourceMethod.ACTION, new ActionArgumentBuilder());
result.put(ResourceMethod.BATCH_UPDATE, new BatchUpdateArgumentBuilder());
result.put(ResourceMethod.BATCH_PARTIAL_UPDATE, new BatchPatchArgumentBuilder());
result.put(ResourceMethod.BATCH_CREATE, new BatchCreateArgumentBuilder());
result.put(ResourceMethod.BATCH_DELETE, new BatchDeleteArgumentBuilder());
result.put(ResourceMethod.GET_ALL, new CollectionArgumentBuilder());
return Collections.unmodifiableMap(result);
}
Aggregations