当前位置: 首页>>代码示例>>Java>>正文


Java ResolvableType.NONE属性代码示例

本文整理汇总了Java中org.springframework.core.ResolvableType.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java ResolvableType.NONE属性的具体用法?Java ResolvableType.NONE怎么用?Java ResolvableType.NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.core.ResolvableType的用法示例。


在下文中一共展示了ResolvableType.NONE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveVariable

private static ResolvableType resolveVariable(TypeVariable<?> typeVariable, ResolvableType contextType) {
    ResolvableType resolvedType;
    if (contextType.hasGenerics()) {
        resolvedType = ResolvableType.forType(typeVariable, contextType);
        if (resolvedType.resolve() != null) {
            return resolvedType;
        }
    }

    ResolvableType superType = contextType.getSuperType();
    if (superType != ResolvableType.NONE) {
        resolvedType = resolveVariable(typeVariable, superType);
        if (resolvedType.resolve() != null) {
            return resolvedType;
        }
    }
    for (ResolvableType ifc : contextType.getInterfaces()) {
        resolvedType = resolveVariable(typeVariable, ifc);
        if (resolvedType.resolve() != null) {
            return resolvedType;
        }
    }
    return ResolvableType.NONE;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:FastJsonHttpMessageConverter.java

示例2: getFieldType

protected static Class<?> getFieldType(java.lang.reflect.Field field) {

		ResolvableType resolvableType = ResolvableType.forField(field);

		if (resolvableType.isArray()) {
			return resolvableType.getComponentType().getRawClass();
		}

		ResolvableType componentType = resolvableType.getGeneric(0);
		if (Iterable.class.isAssignableFrom(field.getType())
				&& componentType != ResolvableType.NONE) {
			return componentType.getRawClass();
		}

		return resolvableType.getRawClass();
	}
 
开发者ID:VanRoy,项目名称:spring-data-jest,代码行数:16,代码来源:MappingBuilder.java

示例3: getType

private static Type getType(Type type, Class<?> contextClass) {
    if (contextClass != null) {
        ResolvableType resolvedType = ResolvableType.forType(type);
        if (type instanceof TypeVariable) {
            ResolvableType resolvedTypeVariable = resolveVariable((TypeVariable) type, ResolvableType.forClass(contextClass));
            if (resolvedTypeVariable != ResolvableType.NONE) {
                return resolvedTypeVariable.resolve();
            }
        } else if (type instanceof ParameterizedType && resolvedType.hasUnresolvableGenerics()) {
            ParameterizedType parameterizedType = (ParameterizedType) type;
            Class<?>[] generics = new Class[parameterizedType.getActualTypeArguments().length];
            Type[] typeArguments = parameterizedType.getActualTypeArguments();

            for (int i = 0; i < typeArguments.length; ++i) {
                Type typeArgument = typeArguments[i];
                if (typeArgument instanceof TypeVariable) {
                    ResolvableType resolvedTypeArgument = resolveVariable((TypeVariable) typeArgument, ResolvableType.forClass(contextClass));
                    if (resolvedTypeArgument != ResolvableType.NONE) {
                        generics[i] = resolvedTypeArgument.resolve();
                    } else {
                        generics[i] = ResolvableType.forType(typeArgument).resolve();
                    }
                } else {
                    generics[i] = ResolvableType.forType(typeArgument).resolve();
                }
            }

            return ResolvableType.forClassWithGenerics(resolvedType.getRawClass(), generics).getType();
        }
    }

    return type;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:FastJsonHttpMessageConverter.java


注:本文中的org.springframework.core.ResolvableType.NONE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。