RpcMetaUtils { public static RpcMetaInfo parseRpcMeta(Method targetMethod) { String serviceName; String methodName; BrpcMeta rpcMeta = targetMethod.getAnnotation(BrpcMeta.class); if (rpcMeta != null) { serviceName = rpcMeta.serviceName(); methodName = rpcMeta.methodName(); } else { serviceName = targetMethod.getDeclaringClass().getName(); methodName = targetMethod.getName(); } log.debug("serviceName={}, methodName={}", serviceName, methodName); RpcMetaInfo rpcMetaInfo = new RpcMetaInfo(); rpcMetaInfo.setServiceName(serviceName); rpcMetaInfo.setMethodName(methodName); return rpcMetaInfo; }  static RpcMetaInfo parseRpcMeta(Method targetMethod);  }
@Test public void testParseRpcMeta() throws Exception { Method method = EchoService.class.getMethod("echo", Echo.EchoRequest.class); RpcMetaUtils.RpcMetaInfo rpcMeta = RpcMetaUtils.parseRpcMeta(method); Assert.assertTrue(rpcMeta.getServiceName().equals("example.EchoService")); Assert.assertTrue(rpcMeta.getMethodName().equals("Echo")); }