@Test public void test_mustBeExposed() { DiagnosticServiceDescriptor<Serializable> descriptor1 = new DiagnosticServiceDescriptor<>(Serializable.class, objectMapper, noop, mbean); assertThat(descriptor1.discoverMBeanName().isPresent(), is(false)); DiagnosticServiceDescriptor<MyService> descriptor2 = new DiagnosticServiceDescriptor<>(MyService.class, new MyServiceImpl(), noop, mbean); assertThat(descriptor2.discoverMBeanName().isPresent(), is(true)); }
Optional<String> discoverMBeanName() { return Optional.ofNullable(serviceImplementation.getClass().getAnnotation(Expose.class)).map(Expose::value); }
DiagnosticServiceDescriptor implements DiagnosticServicesRegistration<T> { Optional<String> discoverMBeanName() { return Optional.ofNullable(serviceImplementation.getClass().getAnnotation(Expose.class)).map(Expose::value); } }
DiagnosticServiceDescriptor implements DiagnosticServicesRegistration<T> { Optional<String> discoverMBeanName() { return Optional.ofNullable(serviceImplementation.getClass().getAnnotation(Expose.class)).map(Expose::value); } DiagnosticServiceDescriptor(Class<T> serviceInterface, T serviceImplementation, Runnable onClose, Function<String, Boolean> jmxExpose); }
DiagnosticServiceDescriptor implements DiagnosticServicesRegistration<T> { Optional<String> discoverMBeanName() { return Optional.ofNullable(serviceImplementation.getClass().getAnnotation(Expose.class)).map(Expose::value); } DiagnosticServiceDescriptor(Class<T> serviceInterface, T serviceImplementation, Runnable onClose, Function<String, Boolean> jmxExpose); @Override Class<T> getServiceInterface(); @Override boolean exposeMBean(String name); @Override void close(); Set<String> getRegisteredMBeans(); }
DiagnosticServiceDescriptor implements DiagnosticServicesRegistration<T> { Optional<String> discoverMBeanName() { return Optional.ofNullable(serviceImplementation.getClass().getAnnotation(Expose.class)).map(Expose::value); } DiagnosticServiceDescriptor(Class<T> serviceInterface, T serviceImplementation, Runnable onClose, Function<String, Boolean> jmxExpose); @Override Class<T> getServiceInterface(); @Override boolean exposeMBean(String name); @Override void close(); Set<String> getRegisteredMBeans();  }