blob: 33ad884c6d5becff56ee4fa83effa6030a883af5 [file] [log] [blame]
ejonaba71ee92014-08-14 14:17:13 -07001package com.google.net.stubby;
2
3import com.google.net.stubby.Server.MethodDefinition;
4import com.google.net.stubby.Server.ServiceDefinition;
5
6import javax.annotation.Nullable;
7import javax.annotation.concurrent.ThreadSafe;
8
9/** Registry of services and their methods for dispatching incoming calls. */
10@ThreadSafe
11public abstract class HandlerRegistry {
12 /** Lookup full method name, starting with '/'. Returns {@code null} if method not found. */
13 @Nullable
14 public abstract Method lookupMethod(String methodName);
15
16 /** A method definition and its parent's service definition. */
17 public static final class Method {
18 private final ServiceDefinition serviceDef;
19 private final MethodDefinition methodDef;
20
21 public Method(ServiceDefinition serviceDef, MethodDefinition methodDef) {
22 this.serviceDef = serviceDef;
23 this.methodDef = methodDef;
24 }
25
26 public ServiceDefinition getServiceDefinition() {
27 return serviceDef;
28 }
29
30 public MethodDefinition getMethodDefinition() {
31 return methodDef;
32 }
33 }
34}