@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); }
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 { 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 { 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 { 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(); }
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();  }