LoggingProxyBuilder { static <API, INSTANCE extends API> Class<?> getCategory(Class<API> apiInterface, INSTANCE instance) { if (instance == null || instance instanceof java.lang.reflect.Proxy) { return apiInterface; } return instance.getClass(); } LoggingProxyBuilder(Class<API> apiInterface, INSTANCE instance); LoggingProxyBuilder<API, INSTANCE> request(Priority level); LoggingProxyBuilder<API, INSTANCE> reply(Priority level); LoggingProxyBuilder<API, INSTANCE> observableReply(Priority level); LoggingProxyBuilder<API, INSTANCE> exception(Priority level); LoggingProxyBuilder<API, INSTANCE> observableError(Priority level); LoggingProxyBuilder<API, INSTANCE> logger(Logger logger); LoggingProxyBuilder<API, INSTANCE> titusRuntime(TitusRuntime titusRuntime); ProxyInvocationHandler buildHandler(); API build();  }
@Test public void testCategoryDefaultsToInstanceIfInstanceNotProxy() throws Exception { MyApi proxy = ProxyCatalog.createGuardingProxy(MyApi.class, new MyApi.MyApiImpl(), () -> true); assertThat(LoggingProxyBuilder.getCategory(MyApi.class, proxy)).isEqualTo(MyApi.class); }
@Test public void testCategoryDefaultsToApiIfInstanceIsProxy() throws Exception { assertThat(LoggingProxyBuilder.getCategory(MyApi.class, new MyApi.MyApiImpl())).isEqualTo(MyApi.MyApiImpl.class); }