@SuppressWarnings({"unchecked"}) private DataType getDataType(Type type, TypeMapping typeMapping) { if (type instanceof Class) { // non-generic type Class<?> nonGenericType = (Class<?>) type; if (nonGenericType.isPrimitive()) { // convert primitive representation to its object equivalent nonGenericType = ParamTypes.PRIMITIVE_TO_OBJECT.get(nonGenericType); } return new JavaType(nonGenericType); } else { // a generic JavaTypeInfo info = helper.createTypeInfo(type, typeMapping); return new JavaGenericType(info); } }
@SuppressWarnings({"unchecked"}) private DataType<?> getDataType(Type type, TypeMapping typeMapping) { if (type instanceof Class) { // non-generic type Class<?> nonGenericType = (Class<?>) type; if (nonGenericType.isPrimitive()) { // convert primitive representation to its object equivalent nonGenericType = ParamTypes.PRIMITIVE_TO_OBJECT.get(nonGenericType); } return new JavaClass(nonGenericType); } else { // a generic JavaTypeInfo info = helper.createTypeInfo(type, typeMapping); return new JavaGenericType(info); } }
@SuppressWarnings({"unchecked"}) private DataType getDataType(Type type, TypeMapping typeMapping) { if (type instanceof Class) { // non-generic type Class<?> nonGenericType = (Class<?>) type; if (nonGenericType.isPrimitive()) { // convert primitive representation to its object equivalent nonGenericType = ParamTypes.PRIMITIVE_TO_OBJECT.get(nonGenericType); } return new JavaType(nonGenericType); } else { // a generic JavaTypeInfo info = helper.createTypeInfo(type, typeMapping); return new JavaGenericType(info); } }
@SuppressWarnings({"unchecked"}) private DataType<?> createDataType(Class<?> physicalType, Type type, TypeMapping mapping) { if (type instanceof Class) { // not a generic return new JavaClass(physicalType); } else { JavaTypeInfo info = helper.createTypeInfo(type, mapping); return new JavaGenericType(info); } }
/** * Returns a data type from a logical and physical type pairing. * * @param physicalType the physical type * @param type the type to construct the data type from * @param mapping the resolved generic type mappings * @return the data type */ @SuppressWarnings({"unchecked"}) private DataType<?> createDataType(Class<?> physicalType, Type type, TypeMapping mapping) { if (type instanceof Class) { // not a generic return new JavaClass(physicalType); } else { JavaTypeInfo info = helper.createTypeInfo(type, mapping); return new JavaGenericType(info); } }
/** * Returns a data type from a logical and physical type pairing. * * @param rawType the raw type * @param actualType the type to construct the data type from * @param mapping the resolved generic type mappings * @return the data type */ @SuppressWarnings({"unchecked"}) private DataType createDataType(Class<?> rawType, Type actualType, TypeMapping mapping) { if (actualType instanceof Class) { // not a generic return new JavaType(rawType); } else { JavaTypeInfo info = helper.createTypeInfo(actualType, mapping); return new JavaGenericType(info); } }
@SuppressWarnings({"unchecked"}) private DataType createDataType(Class<?> physicalType, Type type, TypeMapping mapping) { JavaType dataType; if (type instanceof Class) { // not a generic dataType = new JavaType(physicalType); } else { JavaTypeInfo info = helper.createTypeInfo(type, mapping); dataType = new JavaGenericType(info); } for (TypeIntrospector introspector : typeIntrospectors) { introspector.introspect(dataType); } return dataType; }
/** * Returns the key type of the given Map type. * * @param type a type that is a Map * @param typeMapping the type mapping for resolved parameters * @return the key type */ @SuppressWarnings({"unchecked"}) private DataType getKeyType(Type type, TypeMapping typeMapping) { Type actualType = typeMapping.getActualType(type); if (actualType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) actualType; Type actualKeyType = typeMapping.getActualType(parameterizedType.getActualTypeArguments()[0]); if (actualKeyType instanceof Class) { return new JavaType((Class) actualKeyType); } else { return new JavaGenericType(createTypeInfo(actualKeyType, typeMapping)); } } else if (actualType instanceof Map) { // the map is not parameterized return new JavaType(Object.class); } else { throw new IllegalArgumentException("Type not a Map: " + type); } }
/** * Returns the key type of the given Map type. * * @param type a type that is a Map * @param typeMapping the type mapping for resolved parameters * @return the key type */ @SuppressWarnings({"unchecked"}) private DataType<?> getKeyType(Type type, TypeMapping typeMapping) { Type actualType = typeMapping.getActualType(type); if (actualType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) actualType; Type actualKeyType = typeMapping.getActualType(parameterizedType.getActualTypeArguments()[0]); if (actualKeyType instanceof Class) { return new JavaClass((Class) actualKeyType); } else { return new JavaGenericType(createTypeInfo(actualKeyType, typeMapping)); } } else if (actualType instanceof Map) { // the map is not parameterized return new JavaClass<Object>(Object.class); } else { throw new IllegalArgumentException("Type not a Map: " + type); } }