Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #9064
- Loading branch information
Showing
30 changed files
with
1,230 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...loyment/src/main/java/io/quarkus/mailer/deployment/MailTemplateMailerNameTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.quarkus.mailer.deployment; | ||
|
||
import org.jboss.jandex.AnnotationInstance; | ||
import org.jboss.jandex.AnnotationTarget.Kind; | ||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.arc.processor.AnnotationsTransformer; | ||
|
||
public class MailTemplateMailerNameTransformer implements AnnotationsTransformer { | ||
|
||
@Override | ||
public boolean appliesTo(Kind kind) { | ||
return Kind.FIELD == kind || Kind.METHOD_PARAMETER == kind; | ||
} | ||
|
||
@Override | ||
public void transform(TransformationContext transformationContext) { | ||
DotName type; | ||
|
||
if (transformationContext.getTarget().kind() == Kind.FIELD) { | ||
type = transformationContext.getTarget().asField().type().name(); | ||
} else { | ||
type = transformationContext.getTarget().asMethodParameter().type().name(); | ||
} | ||
|
||
if (!MailerProcessor.MAIL_TEMPLATE.equals(type)) { | ||
return; | ||
} | ||
|
||
AnnotationInstance mailerName = transformationContext.getTarget().annotation(MailerProcessor.MAILER_NAME); | ||
if (mailerName == null) { | ||
return; | ||
} | ||
|
||
transformationContext.transform() | ||
.remove(ai -> MailerProcessor.MAILER_NAME.equals(ai.name())) | ||
.add(MailerProcessor.MAIL_TEMPLATE_MAILER_NAME, mailerName.value()) | ||
.done(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...nsions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailersBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.mailer.deployment; | ||
|
||
import java.util.Set; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
final class MailersBuildItem extends SimpleBuildItem { | ||
|
||
private final boolean hasDefaultMailer; | ||
|
||
private final Set<String> namedMailers; | ||
|
||
public MailersBuildItem(boolean hasDefaultMailer, Set<String> namedMailers) { | ||
this.hasDefaultMailer = hasDefaultMailer; | ||
this.namedMailers = namedMailers; | ||
} | ||
|
||
public boolean hasDefaultMailer() { | ||
return hasDefaultMailer; | ||
} | ||
|
||
public Set<String> getNamedMailers() { | ||
return namedMailers; | ||
} | ||
} |
Oops, something went wrong.