org.springframework.core.ResolvableType.isEntirelyUnresolvable()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.springframework.core.ResolvableType.isEntirelyUnresolvable方法的一些代码示例,展示了ResolvableType.isEntirelyUnresolvable的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResolvableType.isEntirelyUnresolvable方法的具体详情如下:
包路径:org.springframework.core.ResolvableType
类名称:ResolvableType
方法名:isEntirelyUnresolvable

ResolvableType.isEntirelyUnresolvable介绍

[英]Return true if this type contains unresolvable generics only, that is, no substitute for any of its declared type variables.
[中]如果此类型仅包含不可解析的泛型,即不替换其声明的任何类型变量,则返回true。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Resolve the type arguments of the given generic interface against the given
 * target class which is assumed to implement the generic interface and possibly
 * declare concrete types for its type variables.
 * @param clazz the target class to check against
 * @param genericIfc the generic interface or superclass to resolve the type argument from
 * @return the resolved type of each argument, with the array size matching the
 * number of actual type arguments, or {@code null} if not resolvable
 */
@Nullable
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
  ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
  if (!type.hasGenerics() || type.isEntirelyUnresolvable()) {
    return null;
  }
  return type.resolveGenerics(Object.class);
}

代码示例来源:origin: org.springframework/spring-core

/**
 * Resolve the type arguments of the given generic interface against the given
 * target class which is assumed to implement the generic interface and possibly
 * declare concrete types for its type variables.
 * @param clazz the target class to check against
 * @param genericIfc the generic interface or superclass to resolve the type argument from
 * @return the resolved type of each argument, with the array size matching the
 * number of actual type arguments, or {@code null} if not resolvable
 */
@Nullable
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
  ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
  if (!type.hasGenerics() || type.isEntirelyUnresolvable()) {
    return null;
  }
  return type.resolveGenerics(Object.class);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Resolve the type arguments of the given generic interface against the given
 * target class which is assumed to implement the generic interface and possibly
 * declare concrete types for its type variables.
 * @param clazz the target class to check against
 * @param genericIfc the generic interface or superclass to resolve the type argument from
 * @return the resolved type of each argument, with the array size matching the
 * number of actual type arguments, or {@code null} if not resolvable
 */
@Nullable
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
  ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
  if (!type.hasGenerics() || type.isEntirelyUnresolvable()) {
    return null;
  }
  return type.resolveGenerics(Object.class);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

/**
 * Resolve the type arguments of the given generic interface against the given
 * target class which is assumed to implement the generic interface and possibly
 * declare concrete types for its type variables.
 * @param clazz the target class to check against
 * @param genericIfc the generic interface or superclass to resolve the type argument from
 * @return the resolved type of each argument, with the array size matching the
 * number of actual type arguments, or {@code null} if not resolvable
 */
@Nullable
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
  ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
  if (!type.hasGenerics() || type.isEntirelyUnresolvable()) {
    return null;
  }
  return type.resolveGenerics(Object.class);
}

相关文章

微信公众号

最新文章

更多