@Test @DisplayName("obtain the value by `ThrowableMessage` class") void byThrowableMessage() { assertThat(EventClass.fromThrowable(PhoneNotFound.class).value()) .isEqualTo(TestRejections.PhoneNotFound.class); }
public static EventClass fromThrowable(Class<? extends ThrowableMessage> cls) { Method messageThrownMethod; try { messageThrownMethod = cls.getMethod(MESSAGE_THROWN_METHOD); } catch (NoSuchMethodException e) { throw illegalStateWithCauseOf(e); } @SuppressWarnings("unchecked") Class<? extends RejectionMessage> returnType = (Class<? extends RejectionMessage>) messageThrownMethod.getReturnType(); return from(returnType); }
EventClass extends MessageClass<EventMessage> { public static EventClass fromThrowable(Class<? extends ThrowableMessage> cls) { Method messageThrownMethod; try { messageThrownMethod = cls.getMethod(MESSAGE_THROWN_METHOD); } catch (NoSuchMethodException e) { throw illegalStateWithCauseOf(e); } @SuppressWarnings("unchecked") Class<? extends RejectionMessage> returnType = (Class<? extends RejectionMessage>) messageThrownMethod.getReturnType(); return from(returnType); } }
EventClass extends MessageClass<EventMessage> { public static EventClass fromThrowable(Class<? extends ThrowableMessage> cls) { Method messageThrownMethod; try { messageThrownMethod = cls.getMethod(MESSAGE_THROWN_METHOD); } catch (NoSuchMethodException e) { throw illegalStateWithCauseOf(e); } @SuppressWarnings("unchecked") Class<? extends RejectionMessage> returnType = (Class<? extends RejectionMessage>) messageThrownMethod.getReturnType(); return from(returnType); } private  EventClass(Class<? extends EventMessage> value); private  EventClass(Class<? extends EventMessage> value, TypeUrl typeUrl); }
EventClass extends MessageClass<EventMessage> { public static EventClass fromThrowable(Class<? extends ThrowableMessage> cls) { Method messageThrownMethod; try { messageThrownMethod = cls.getMethod(MESSAGE_THROWN_METHOD); } catch (NoSuchMethodException e) { throw illegalStateWithCauseOf(e); } @SuppressWarnings("unchecked") Class<? extends RejectionMessage> returnType = (Class<? extends RejectionMessage>) messageThrownMethod.getReturnType(); return from(returnType); } private  EventClass(Class<? extends EventMessage> value); private  EventClass(Class<? extends EventMessage> value, TypeUrl typeUrl); static EventClass from(Class<? extends EventMessage> rawClass); static EventClass fromThrowable(Class<? extends ThrowableMessage> cls); @SuppressWarnings("unchecked") // Logically checked. static EventClass from(TypeUrl typeUrl); static EventClass from(Event event); static EventClass of(Message eventOrMessage); static ImmutableSet<EventClass> setOf(Iterable<Class<? extends EventMessage>> classes); @SafeVarargs static ImmutableSet<EventClass> setOf(Class<? extends EventMessage>... classes); static ImmutableSet<EventClass> setOf(Class<? extends EventMessage> cls); }
EventClass extends MessageClass<EventMessage> { public static EventClass fromThrowable(Class<? extends ThrowableMessage> cls) { Method messageThrownMethod; try { messageThrownMethod = cls.getMethod(MESSAGE_THROWN_METHOD); } catch (NoSuchMethodException e) { throw illegalStateWithCauseOf(e); } @SuppressWarnings("unchecked") Class<? extends RejectionMessage> returnType = (Class<? extends RejectionMessage>) messageThrownMethod.getReturnType(); return from(returnType); } private  EventClass(Class<? extends EventMessage> value); private  EventClass(Class<? extends EventMessage> value, TypeUrl typeUrl); static EventClass from(Class<? extends EventMessage> rawClass); static EventClass fromThrowable(Class<? extends ThrowableMessage> cls); @SuppressWarnings("unchecked") // Logically checked. static EventClass from(TypeUrl typeUrl); static EventClass from(Event event); static EventClass of(Message eventOrMessage); static ImmutableSet<EventClass> setOf(Iterable<Class<? extends EventMessage>> classes); @SafeVarargs static ImmutableSet<EventClass> setOf(Class<? extends EventMessage>... classes); static ImmutableSet<EventClass> setOf(Class<? extends EventMessage> cls);  }