Search in sources :

Example 86 with JavaType

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.

the class Fixed32ReadSchemas method create.

public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
    JavaType javaType = propertyDescriptor.getJavaType();
    if (int.class.equals(javaType.getRawClass())) {
        return new Fixed32PrimitiveSchema<>(protoField, propertyDescriptor);
    }
    if (Integer.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
        return new Fixed32Schema<>(protoField, propertyDescriptor);
    }
    ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
    return null;
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType)

Example 87 with JavaType

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.

the class FloatReadSchemas method create.

public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
    JavaType javaType = propertyDescriptor.getJavaType();
    if (float.class.equals(javaType.getRawClass())) {
        return new FloatPrimitiveSchema<>(protoField, propertyDescriptor);
    }
    if (Float.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
        return new FloatSchema<>(protoField, propertyDescriptor);
    }
    ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
    return null;
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType)

Example 88 with JavaType

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.

the class EnumsReadSchemas method create.

public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
    JavaType javaType = propertyDescriptor.getJavaType();
    if (javaType.isEnumType()) {
        return new EnumSchema<>(protoField, propertyDescriptor);
    }
    if (Integer.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
        return new IntEnumSchema<>(protoField, propertyDescriptor);
    }
    if (int.class.equals(javaType.getRawClass())) {
        return new IntPrimitiveEnumSchema<>(protoField, propertyDescriptor);
    }
    if (javaType.isTypeOrSubTypeOf(DynamicEnum.class)) {
        return new DynamicEnumSchema<>(protoField, propertyDescriptor);
    }
    ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
    return null;
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType)

Example 89 with JavaType

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.

the class Fixed64ReadSchemas method create.

public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
    JavaType javaType = propertyDescriptor.getJavaType();
    if (long.class.equals(javaType.getRawClass())) {
        return new Fixed64PrimitiveSchema<>(protoField, propertyDescriptor);
    }
    if (Long.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
        return new Fixed64Schema<>(protoField, propertyDescriptor);
    }
    ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
    return null;
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType)

Example 90 with JavaType

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project java-chassis by ServiceComb.

the class SInt32ReadSchemas method create.

public static <T> FieldSchema<T> create(Field protoField, PropertyDescriptor propertyDescriptor) {
    JavaType javaType = propertyDescriptor.getJavaType();
    if (int.class.equals(javaType.getRawClass())) {
        return new SInt32PrimitiveSchema<>(protoField, propertyDescriptor);
    }
    if (Integer.class.equals(javaType.getRawClass()) || javaType.isJavaLangObject()) {
        return new SInt32Schema<>(protoField, propertyDescriptor);
    }
    ProtoUtils.throwNotSupportMerge(protoField, propertyDescriptor.getJavaType());
    return null;
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType)

Aggregations

JavaType (com.fasterxml.jackson.databind.JavaType)322 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)36 Test (org.junit.Test)29 BeanDescription (com.fasterxml.jackson.databind.BeanDescription)25 IOException (java.io.IOException)25 BeanPropertyDefinition (com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition)22 ArrayList (java.util.ArrayList)21 TypeFactory (com.fasterxml.jackson.databind.type.TypeFactory)17 Property (io.swagger.models.properties.Property)16 List (java.util.List)16 Map (java.util.Map)14 ModelImpl (io.swagger.models.ModelImpl)13 StringProperty (io.swagger.models.properties.StringProperty)13 Annotation (java.lang.annotation.Annotation)12 Method (java.lang.reflect.Method)11 Type (java.lang.reflect.Type)11 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)10 BodyParameter (io.swagger.models.parameters.BodyParameter)10 MapProperty (io.swagger.models.properties.MapProperty)10 JsonDeserializer (com.fasterxml.jackson.databind.JsonDeserializer)9