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.
Allow JsonObject and JsonArray to be used in any POJO for JSON handling
Closes: quarkusio#39599
- Loading branch information
Showing
10 changed files
with
147 additions
and
4 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
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
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
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
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
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
30 changes: 30 additions & 0 deletions
30
...s/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/jackson/JsonArrayDeserializer.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,30 @@ | ||
package io.quarkus.vertx.runtime.jackson; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.databind.JavaType; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer; | ||
import com.fasterxml.jackson.databind.util.Converter; | ||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
|
||
import io.vertx.core.json.JsonArray; | ||
|
||
public class JsonArrayDeserializer extends StdDelegatingDeserializer<JsonArray> { | ||
|
||
public JsonArrayDeserializer() { | ||
super(new StdConverter<List<?>, JsonArray>() { | ||
@Override | ||
public JsonArray convert(List list) { | ||
return new JsonArray(list); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected StdDelegatingDeserializer<JsonArray> withDelegate(Converter<Object, JsonArray> converter, | ||
JavaType delegateType, | ||
JsonDeserializer<?> delegateDeserializer) { | ||
return new StdDelegatingDeserializer<>(converter, delegateType, delegateDeserializer); | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
.../vertx/runtime/src/main/java/io/quarkus/vertx/runtime/jackson/JsonObjectDeserializer.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,30 @@ | ||
package io.quarkus.vertx.runtime.jackson; | ||
|
||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.databind.JavaType; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer; | ||
import com.fasterxml.jackson.databind.util.Converter; | ||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
|
||
public class JsonObjectDeserializer extends StdDelegatingDeserializer<JsonObject> { | ||
|
||
public JsonObjectDeserializer() { | ||
super(new StdConverter<Map<?, ?>, JsonObject>() { | ||
@Override | ||
public JsonObject convert(Map map) { | ||
return new JsonObject(map); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected StdDelegatingDeserializer<JsonObject> withDelegate(Converter<Object, JsonObject> converter, | ||
JavaType delegateType, | ||
JsonDeserializer<?> delegateDeserializer) { | ||
return new StdDelegatingDeserializer<>(converter, delegateType, delegateDeserializer); | ||
} | ||
} |
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