@@ -90,8 +90,12 @@ <T> void roundTrip(final T value, final String json) {
90
90
}
91
91
92
92
<T > void roundTrip (final PojoCodecProvider .Builder builder , final T value , final String json ) {
93
- encodesTo (getCodecRegistry (builder ), value , json );
94
- decodesTo (getCodecRegistry (builder ), json , value );
93
+ roundTrip (builder , value .getClass (), value , json );
94
+ }
95
+
96
+ <T > void roundTrip (final PojoCodecProvider .Builder builder , final Class <?> clazz , final T value , final String json ) {
97
+ encodesTo (getCodecRegistry (builder ), clazz , value , json );
98
+ decodesTo (getCodecRegistry (builder ), clazz , json , value );
95
99
}
96
100
97
101
<T > void threadedRoundTrip (final PojoCodecProvider .Builder builder , final T value , final String json ) {
@@ -109,21 +113,30 @@ <T> void roundTrip(final CodecRegistry registry, final T value, final String jso
109
113
decodesTo (registry , json , value );
110
114
}
111
115
116
+ <T > void roundTrip (final CodecRegistry registry , final Class <T > clazz , final T value , final String json ) {
117
+ encodesTo (registry , clazz , value , json );
118
+ decodesTo (registry , clazz , json , value );
119
+ }
120
+
112
121
<T > void encodesTo (final PojoCodecProvider .Builder builder , final T value , final String json ) {
113
122
encodesTo (builder , value , json , false );
114
123
}
115
124
116
125
<T > void encodesTo (final PojoCodecProvider .Builder builder , final T value , final String json , final boolean collectible ) {
117
- encodesTo (getCodecRegistry (builder ), value , json , collectible );
126
+ encodesTo (getCodecRegistry (builder ), value . getClass (), value , json , collectible );
118
127
}
119
128
120
129
<T > void encodesTo (final CodecRegistry registry , final T value , final String json ) {
121
- encodesTo (registry , value , json , false );
130
+ encodesTo (registry , value .getClass (), value , json , false );
131
+ }
132
+
133
+ <T > void encodesTo (final CodecRegistry registry , final Class <?> clazz , final T value , final String json ) {
134
+ encodesTo (registry , clazz , value , json , false );
122
135
}
123
136
124
137
@ SuppressWarnings ("unchecked" )
125
- <T > void encodesTo (final CodecRegistry registry , final T value , final String json , final boolean collectible ) {
126
- Codec <T > codec = (Codec <T >) registry .get (value . getClass () );
138
+ <T > void encodesTo (final CodecRegistry registry , final Class <?> clazz , final T value , final String json , final boolean collectible ) {
139
+ Codec <T > codec = (Codec <T >) registry .get (clazz );
127
140
encodesTo (codec , value , json , collectible );
128
141
}
129
142
@@ -144,7 +157,12 @@ <T> void decodesTo(final PojoCodecProvider.Builder builder, final String json, f
144
157
145
158
@ SuppressWarnings ("unchecked" )
146
159
<T > void decodesTo (final CodecRegistry registry , final String json , final T expected ) {
147
- Codec <T > codec = (Codec <T >) registry .get (expected .getClass ());
160
+ decodesTo (registry , expected .getClass (), json , expected );
161
+ }
162
+
163
+ @ SuppressWarnings ("unchecked" )
164
+ <T > void decodesTo (final CodecRegistry registry , final Class <?> clazz , final String json , final T expected ) {
165
+ Codec <T > codec = (Codec <T >) registry .get (clazz );
148
166
decodesTo (codec , json , expected );
149
167
}
150
168
0 commit comments