6
6
import java .net .URL ;
7
7
8
8
import com .fasterxml .jackson .core .Version ;
9
-
9
+ import com . fasterxml . jackson . core . type . TypeReference ;
10
10
import com .fasterxml .jackson .databind .JavaType ;
11
11
import com .fasterxml .jackson .databind .JsonMappingException ;
12
12
import com .fasterxml .jackson .databind .ObjectMapper ;
@@ -65,7 +65,6 @@ protected ProtobufMapper(ProtobufMapper src) {
65
65
/**
66
66
* @since 2.10
67
67
*/
68
- @ SuppressWarnings ("unchecked" )
69
68
public static ProtobufMapper .Builder builder () {
70
69
return new Builder (new ProtobufMapper ());
71
70
}
@@ -118,7 +117,9 @@ public void setSchemaLoader(ProtobufSchemaLoader l) {
118
117
* given Java type. Uses {@link ProtobufSchemaGenerator} for
119
118
* generation.
120
119
*
121
- * @since 2.8
120
+ * @param type Resolved type to generate {@link ProtobufSchema} for
121
+ *
122
+ * @return Generated {@link ProtobufSchema}
122
123
*/
123
124
public ProtobufSchema generateSchemaFor (JavaType type ) throws JsonMappingException
124
125
{
@@ -129,8 +130,11 @@ public ProtobufSchema generateSchemaFor(JavaType type) throws JsonMappingExcepti
129
130
130
131
/**
131
132
* Convenience method for constructing protoc definition that matches
132
- * given Java type. Uses {@link ProtobufSchemaGenerator} for
133
- * generation.
133
+ * given Java type. Uses {@link ProtobufSchemaGenerator} for generation.
134
+ *
135
+ * @param type Type-erased type to generate {@link ProtobufSchema} for
136
+ *
137
+ * @return Generated {@link ProtobufSchema}
134
138
*
135
139
* @since 2.8
136
140
*/
@@ -141,6 +145,20 @@ public ProtobufSchema generateSchemaFor(Class<?> type) throws JsonMappingExcepti
141
145
return gen .getGeneratedSchema ();
142
146
}
143
147
148
+ /**
149
+ * Convenience method for constructing protoc definition that matches
150
+ * given Java type. Uses {@link ProtobufSchemaGenerator} for generation.
151
+ *
152
+ * @param type Type to generate {@link ProtobufSchema} for
153
+ *
154
+ * @return Generated {@link ProtobufSchema}
155
+ *
156
+ * @since 2.10
157
+ */
158
+ public ProtobufSchema generateSchemaFor (TypeReference <?> type ) throws JsonMappingException {
159
+ return generateSchemaFor (_typeFactory .constructType (type ));
160
+ }
161
+
144
162
/*
145
163
/**********************************************************
146
164
/* Schema access, FileDescriptorSets (since 2.9)
0 commit comments