-
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.
feat(xjx-serdes): add better map support
- Loading branch information
1 parent
7d45033
commit 5be835c
Showing
17 changed files
with
559 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,4 @@ | |
|
||
public record EndTag(String namespace, String name) { | ||
|
||
public EndTag(String name) { | ||
this(null, name); | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
xjx-serdes/src/main/java/io/jonasg/xjx/serdes/deserialize/MapAsRoot.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,6 @@ | ||
package io.jonasg.xjx.serdes.deserialize; | ||
|
||
import java.util.Map; | ||
|
||
public record MapAsRoot(Object root, Map<String, Object> map) { | ||
} |
27 changes: 27 additions & 0 deletions
27
xjx-serdes/src/main/java/io/jonasg/xjx/serdes/deserialize/MapOf.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,27 @@ | ||
package io.jonasg.xjx.serdes.deserialize; | ||
|
||
import java.lang.reflect.ParameterizedType; | ||
import java.lang.reflect.Type; | ||
|
||
public abstract class MapOf<K, V> { | ||
|
||
protected final Type keyType; | ||
|
||
protected final Type valueType; | ||
|
||
protected MapOf() { | ||
Type superClass = this.getClass().getGenericSuperclass(); | ||
this.keyType = ((ParameterizedType) superClass).getActualTypeArguments()[0]; | ||
this.valueType = ((ParameterizedType) superClass).getActualTypeArguments()[1]; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public Class<K> keyType() { | ||
return (Class<K>) keyType; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public Class<V> valueType() { | ||
return (Class<V>) valueType; | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
xjx-serdes/src/main/java/io/jonasg/xjx/serdes/deserialize/MapWithTypeInfo.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,7 @@ | ||
package io.jonasg.xjx.serdes.deserialize; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public record MapWithTypeInfo(Map<String, Object> map, Class<?> valueType) { | ||
} |
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
Oops, something went wrong.