use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.
the class SFixed64ReadSchemas method create.
public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
JavaType javaType = propertyDescriptor.getJavaType();
if (long.class.equals(javaType.getRawClass())) {
return new SFixed64PrimitiveSchema<>(protoField, propertyDescriptor);
}
if (Long.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
return new SFixed64Schema<>(protoField, propertyDescriptor);
}
ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
return null;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.
the class SInt64ReadSchemas method create.
public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
JavaType javaType = propertyDescriptor.getJavaType();
if (long.class.equals(javaType.getRawClass())) {
return new SInt64PrimitiveSchema<>(protoField, propertyDescriptor);
}
if (Long.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
return new SInt64Schema<>(protoField, propertyDescriptor);
}
ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
return null;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.
the class BytesReadSchemas method create.
public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
JavaType javaType = propertyDescriptor.getJavaType();
if (byte[].class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
return new BytesSchema<>(protoField, propertyDescriptor);
}
ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
return null;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.
the class TestModelResolverExt method setType.
@Test
public void setType() {
JavaType type = TypeFactory.defaultInstance().constructCollectionType(List.class, String.class);
resolver.setType(type, vendorExtensions);
Assert.assertEquals("java.util.List<java.lang.String>", vendorExtensions.get(SwaggerConst.EXT_JAVA_CLASS));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.
the class TestResponsesMeta method test.
@Test
public void test() {
Swagger swagger = SwaggerGenerator.generate(ResponseMetaImpl.class);
Operation operation = swagger.getPath("/add").getPost();
ResponsesMeta meta = new ResponsesMeta();
meta.init(swagger, operation);
JavaType resp = meta.findResponseType(200);
Assert.assertEquals(Integer.class, resp.getRawClass());
resp = meta.findResponseType(201);
Assert.assertEquals(Integer.class, resp.getRawClass());
resp = meta.findResponseType(400);
Assert.assertEquals(String.class, resp.getRawClass());
resp = meta.findResponseType(401);
Assert.assertEquals(Long.class, resp.getRawClass());
resp = meta.findResponseType(500);
// changed to Object for new version to keep user defined error data not lose and can be parsed.
Assert.assertEquals(Object.class, resp.getRawClass());
}
Aggregations