File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
main/java/tools/jackson/dataformat/avro/schema
test/java/tools/jackson/dataformat/avro/schema Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11
11
import tools .jackson .databind .introspect .AnnotatedClass ;
12
12
import tools .jackson .databind .jsonFormatVisitors .JsonStringFormatVisitor ;
13
13
import tools .jackson .databind .jsonFormatVisitors .JsonValueFormat ;
14
- import tools .jackson .databind .type .TypeFactory ;
15
14
16
15
public class StringVisitor extends JsonStringFormatVisitor .Base
17
16
implements SchemaBuilder
@@ -38,7 +37,8 @@ public void enumTypes(Set<String> enums) {
38
37
public Schema builtAvroSchema () {
39
38
// Unlike Jackson, Avro treats characters as an int with the java.lang.Character class type.
40
39
if (_type .hasRawClass (char .class ) || _type .hasRawClass (Character .class )) {
41
- return AvroSchemaHelper .numericAvroSchema (NumberType .INT , TypeFactory .defaultInstance ().constructType (Character .class ));
40
+ // should we construct JavaType for `Character.class` in case of primitive or... ?
41
+ return AvroSchemaHelper .numericAvroSchema (NumberType .INT , _type );
42
42
}
43
43
// [dataformats-binary#179]: need special help with UUIDs, to coerce into Binary
44
44
// (could actually be
Original file line number Diff line number Diff line change 26
26
@ RunWith (Parameterized .class )
27
27
public class DateTimeVisitor_builtAvroSchemaTest {
28
28
29
- private static final TypeFactory TYPE_FACTORY = TypeFactory .defaultInstance ();
30
-
31
29
@ Parameter (0 )
32
30
public Class <?> testClass ;
33
31
@@ -73,14 +71,16 @@ public static Collection<?> testData() {
73
71
LocalTime .class ,
74
72
JsonParser .NumberType .INT ,
75
73
Schema .Type .INT ,
76
- "time-millis" },
74
+ "time-millis"
75
+ }
77
76
});
78
77
}
79
78
80
79
@ Test
81
80
public void builtAvroSchemaTest () {
82
81
// GIVEN
83
- DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (TYPE_FACTORY .constructSimpleType (testClass , null ));
82
+ final TypeFactory tf = TypeFactory .createDefaultInstance ();
83
+ DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (tf .constructSimpleType (testClass , null ));
84
84
dateTimeVisitor .numberType (givenNumberType );
85
85
86
86
// WHEN
You can’t perform that action at this time.
0 commit comments