forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qute: skip type-safe validation for JsonObject
-if JsonObjectValueResolver is registered
- Loading branch information
1 parent
de635e1
commit 1ae8c74
Showing
2 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
18 changes: 15 additions & 3 deletions
18
extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/JsonObjectProcessor.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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
package io.quarkus.qute.deployment; | ||
|
||
import java.util.function.Predicate; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.Capabilities; | ||
import io.quarkus.deployment.Capability; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.qute.runtime.jsonobject.JsonObjectValueResolver; | ||
import io.quarkus.qute.deployment.TypeCheckExcludeBuildItem.TypeCheck; | ||
|
||
public class JsonObjectProcessor { | ||
|
||
@BuildStep | ||
void init(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> beans) { | ||
void init(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> beans, | ||
BuildProducer<TypeCheckExcludeBuildItem> typeCheckExcludes) { | ||
if (capabilities.isPresent(Capability.VERTX)) { | ||
beans.produce(new AdditionalBeanBuildItem(JsonObjectValueResolver.class)); | ||
beans.produce(new AdditionalBeanBuildItem("io.quarkus.qute.runtime.jsonobject.JsonObjectValueResolver")); | ||
DotName jsonObjectName = DotName.createSimple("io.vertx.core.json.JsonObject"); | ||
typeCheckExcludes.produce(new TypeCheckExcludeBuildItem(new Predicate<TypeCheckExcludeBuildItem.TypeCheck>() { | ||
@Override | ||
public boolean test(TypeCheck tc) { | ||
return tc.classNameEquals(jsonObjectName); | ||
} | ||
})); | ||
} | ||
} | ||
} |
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