Search in sources :

Example 1 with MethodAdapterRegistry

use of com.linkedin.restli.internal.server.methods.MethodAdapterRegistry in project rest.li by linkedin.

the class RestLiServer method buildRestLiArgumentBuilder.

/**
   * Builder for building a {@link RestLiArgumentBuilder}
   *
   * @param method the REST method
   * @param errorResponseBuilder the {@link ErrorResponseBuilder}
   * @return a {@link RestLiArgumentBuilder}
   */
private RestLiArgumentBuilder buildRestLiArgumentBuilder(RoutingResult method, ErrorResponseBuilder errorResponseBuilder) {
    ResourceMethodDescriptor resourceMethodDescriptor = method.getResourceMethod();
    RestLiArgumentBuilder adapter = new MethodAdapterRegistry(errorResponseBuilder).getArgumentBuilder(resourceMethodDescriptor.getType());
    if (adapter == null) {
        throw new IllegalArgumentException("Unsupported method type: " + resourceMethodDescriptor.getType());
    }
    return adapter;
}
Also used : ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) RestLiArgumentBuilder(com.linkedin.restli.internal.server.methods.arguments.RestLiArgumentBuilder) MethodAdapterRegistry(com.linkedin.restli.internal.server.methods.MethodAdapterRegistry)

Example 2 with MethodAdapterRegistry

use of com.linkedin.restli.internal.server.methods.MethodAdapterRegistry in project rest.li by linkedin.

the class RestLiServerUtils method buildRestLiArgumentBuilder.

/**
   * Builds a RestLiArgument builder
   *
   * @param method
   *          {@link RoutingResult}
   * @param errorResponseBuilder
   *          {@link ErrorResponseBuilder}
   * @return
   */
public static RestLiArgumentBuilder buildRestLiArgumentBuilder(RoutingResult method, ErrorResponseBuilder errorResponseBuilder) {
    ResourceMethodDescriptor resourceMethodDescriptor = method.getResourceMethod();
    RestLiArgumentBuilder adapter = new MethodAdapterRegistry(errorResponseBuilder).getArgumentBuilder(resourceMethodDescriptor.getType());
    if (adapter == null) {
        throw new IllegalArgumentException("Unsupported method type: " + resourceMethodDescriptor.getType());
    }
    return adapter;
}
Also used : ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) RestLiArgumentBuilder(com.linkedin.restli.internal.server.methods.arguments.RestLiArgumentBuilder) MethodAdapterRegistry(com.linkedin.restli.internal.server.methods.MethodAdapterRegistry)

Aggregations

MethodAdapterRegistry (com.linkedin.restli.internal.server.methods.MethodAdapterRegistry)2 RestLiArgumentBuilder (com.linkedin.restli.internal.server.methods.arguments.RestLiArgumentBuilder)2 ResourceMethodDescriptor (com.linkedin.restli.internal.server.model.ResourceMethodDescriptor)2