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

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

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

ResolvableType.isUnresolvableTypeVariable介绍

[英]Determine whether the underlying type is a type variable that cannot be resolved through the associated variable resolver.
[中]

代码示例

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

/**
 * Determine whether the underlying type is a type variable that
 * cannot be resolved through the associated variable resolver.
 */
private boolean isUnresolvableTypeVariable() {
  if (this.type instanceof TypeVariable) {
    if (this.variableResolver == null) {
      return true;
    }
    TypeVariable<?> variable = (TypeVariable<?>) this.type;
    ResolvableType resolved = this.variableResolver.resolveVariable(variable);
    if (resolved == null || resolved.isUnresolvableTypeVariable()) {
      return true;
    }
  }
  return false;
}

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

/**
 * Return {@code true} if this type contains unresolvable generics only,
 * that is, no substitute for any of its declared type variables.
 */
boolean isEntirelyUnresolvable() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (!generic.isUnresolvableTypeVariable() && !generic.isWildcardWithoutBounds()) {
      return false;
    }
  }
  return true;
}

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

/**
 * Determine whether the underlying type is a type variable that
 * cannot be resolved through the associated variable resolver.
 */
private boolean isUnresolvableTypeVariable() {
  if (this.type instanceof TypeVariable) {
    if (this.variableResolver == null) {
      return true;
    }
    TypeVariable<?> variable = (TypeVariable<?>) this.type;
    ResolvableType resolved = this.variableResolver.resolveVariable(variable);
    if (resolved == null || resolved.isUnresolvableTypeVariable()) {
      return true;
    }
  }
  return false;
}

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

/**
 * Return {@code true} if this type contains unresolvable generics only,
 * that is, no substitute for any of its declared type variables.
 */
boolean isEntirelyUnresolvable() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (!generic.isUnresolvableTypeVariable() && !generic.isWildcardWithoutBounds()) {
      return false;
    }
  }
  return true;
}

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

/**
 * Determine whether the underlying type has any unresolvable generics:
 * either through an unresolvable type variable on the type itself
 * or through implementing a generic interface in a raw fashion,
 * i.e. without substituting that interface's type variables.
 * The result will be {@code true} only in those two scenarios.
 */
public boolean hasUnresolvableGenerics() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (generic.isUnresolvableTypeVariable() || generic.isWildcardWithoutBounds()) {
      return true;
    }
  }
  Class<?> resolved = resolve();
  if (resolved != null) {
    for (Type genericInterface : resolved.getGenericInterfaces()) {
      if (genericInterface instanceof Class) {
        if (forClass((Class<?>) genericInterface).hasGenerics()) {
          return true;
        }
      }
    }
    return getSuperType().hasUnresolvableGenerics();
  }
  return false;
}

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

/**
 * Determine whether the underlying type has any unresolvable generics:
 * either through an unresolvable type variable on the type itself
 * or through implementing a generic interface in a raw fashion,
 * i.e. without substituting that interface's type variables.
 * The result will be {@code true} only in those two scenarios.
 */
public boolean hasUnresolvableGenerics() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (generic.isUnresolvableTypeVariable() || generic.isWildcardWithoutBounds()) {
      return true;
    }
  }
  Class<?> resolved = resolve();
  if (resolved != null) {
    for (Type genericInterface : resolved.getGenericInterfaces()) {
      if (genericInterface instanceof Class) {
        if (forClass((Class<?>) genericInterface).hasGenerics()) {
          return true;
        }
      }
    }
    return getSuperType().hasUnresolvableGenerics();
  }
  return false;
}

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

/**
 * Determine whether the underlying type is a type variable that
 * cannot be resolved through the associated variable resolver.
 */
private boolean isUnresolvableTypeVariable() {
  if (this.type instanceof TypeVariable) {
    if (this.variableResolver == null) {
      return true;
    }
    TypeVariable<?> variable = (TypeVariable<?>) this.type;
    ResolvableType resolved = this.variableResolver.resolveVariable(variable);
    if (resolved == null || resolved.isUnresolvableTypeVariable()) {
      return true;
    }
  }
  return false;
}

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

/**
 * Determine whether the underlying type has any unresolvable generics:
 * either through an unresolvable type variable on the type itself
 * or through implementing a generic interface in a raw fashion,
 * i.e. without substituting that interface's type variables.
 * The result will be {@code true} only in those two scenarios.
 */
public boolean hasUnresolvableGenerics() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (generic.isUnresolvableTypeVariable() || generic.isWildcardWithoutBounds()) {
      return true;
    }
  }
  Class<?> resolved = resolve();
  if (resolved != null) {
    for (Type genericInterface : resolved.getGenericInterfaces()) {
      if (genericInterface instanceof Class) {
        if (forClass((Class<?>) genericInterface).hasGenerics()) {
          return true;
        }
      }
    }
    return getSuperType().hasUnresolvableGenerics();
  }
  return false;
}

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

/**
 * Return {@code true} if this type contains unresolvable generics only,
 * that is, no substitute for any of its declared type variables.
 */
boolean isEntirelyUnresolvable() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (!generic.isUnresolvableTypeVariable() && !generic.isWildcardWithoutBounds()) {
      return false;
    }
  }
  return true;
}

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

/**
 * Determine whether the underlying type has any unresolvable generics:
 * either through an unresolvable type variable on the type itself
 * or through implementing a generic interface in a raw fashion,
 * i.e. without substituting that interface's type variables.
 * The result will be {@code true} only in those two scenarios.
 */
public boolean hasUnresolvableGenerics() {
  if (this == NONE) {
    return false;
  }
  ResolvableType[] generics = getGenerics();
  for (ResolvableType generic : generics) {
    if (generic.isUnresolvableTypeVariable() || generic.isWildcardWithoutBounds()) {
      return true;
    }
  }
  Class<?> resolved = resolve();
  if (resolved != null) {
    for (Type genericInterface : resolved.getGenericInterfaces()) {
      if (genericInterface instanceof Class) {
        if (forClass((Class<?>) genericInterface).hasGenerics()) {
          return true;
        }
      }
    }
    return getSuperType().hasUnresolvableGenerics();
  }
  return false;
}

相关文章

微信公众号

最新文章

更多