@Override public Sender provide(Class<?>[] typeargs, Annotation[] qualifiers) { String toSubject = null, replyTo = null; typeargs = typeargs == null ? new Class<?>[0] : typeargs; for (final Annotation a : qualifiers) { if (a instanceof ToSubject) { toSubject = ((ToSubject) a).value(); } else if (a instanceof ReplyTo) { replyTo = ((ReplyTo) a).value(); } } if (typeargs.length != 1) { throw new RuntimeException(PROVIDER_EXCEPTION_ERROR_MSG_BASE + ": Type at injection point must have exactly" + " one type parameter. (found: " + typeargs.length + ")"); } if (toSubject == null) { throw new RuntimeException(PROVIDER_EXCEPTION_ERROR_MSG_BASE + ": Required " + ToSubject.class.getName() + " qualifier missing at injection point."); } return ErraiMessageSender.of(toSubject, replyTo, ErraiBus.get()); }
@Override public Sender provide(Class<?>[] typeargs, Annotation[] qualifiers) { String toSubject = null, replyTo = null; typeargs = typeargs == null ? new Class<?>[0] : typeargs; for (final Annotation a : qualifiers) { if (a instanceof ToSubject) { toSubject = ((ToSubject) a).value(); } else if (a instanceof ReplyTo) { replyTo = ((ReplyTo) a).value(); } } if (typeargs.length != 1) { throw new RuntimeException(PROVIDER_EXCEPTION_ERROR_MSG_BASE + ": Type at injection point must have exactly" + " one type parameter. (found: " + typeargs.length + ")"); } if (toSubject == null) { throw new RuntimeException(PROVIDER_EXCEPTION_ERROR_MSG_BASE + ": Required " + ToSubject.class.getName() + " qualifier missing at injection point."); } return ErraiMessageSender.of(toSubject, replyTo, ErraiBus.get()); }
@Override public Object create(final CreationalContext creationalContext) { String toSubject = null, replyTo = null; for (final Annotation a : qualifiers) { if (a instanceof ToSubject) { toSubject = ((ToSubject) a).value(); } else if (a instanceof ReplyTo) { replyTo = ((ReplyTo) a).value(); } } if (toSubject == null) { throw new ProviderException(PROVIDER_EXCEPTION_ERROR_MSG_BASE + ": Required " + ToSubject.class.getName() + " qualifier missing at injection point."); } return ErraiMessageSender.of(toSubject, replyTo, bus); }