io.quarkus.mailer.MailerName Maven / Gradle / Ivy
package io.quarkus.mailer;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import jakarta.enterprise.util.AnnotationLiteral;
import jakarta.inject.Qualifier;
/**
* Marker annotation to select the Mailer.
*
* For example, if the Mailer is configured like so in {@code application.properties}:
*
*
* quarkus.mailer.client1.host = smtp.example.com
*
*
* Then to inject the proper {@code Mailer}, you would need to use {@code MailerName} like indicated below:
*
*
* @Inject
* @MailerName("client1")
* Mailer mailer;
*
*/
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface MailerName {
/**
* The Mailer name.
*/
String value() default "";
class Literal extends AnnotationLiteral implements MailerName {
public static Literal of(String value) {
return new Literal(value);
}
private final String value;
public Literal(String value) {
this.value = value;
}
@Override
public String value() {
return value;
}
}
}