com.google.common.reflect.TypeToken.getCovariantTypeResolver()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(80)

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

TypeToken.getCovariantTypeResolver介绍

暂无

代码示例

代码示例来源:origin: google/guava

private TypeToken<?> resolveSupertype(Type type) {
 TypeToken<?> supertype = of(getCovariantTypeResolver().resolveType(type));
 // super types' type mapping is a subset of type mapping of this type.
 supertype.covariantTypeResolver = covariantTypeResolver;
 supertype.invariantTypeResolver = invariantTypeResolver;
 return supertype;
}

代码示例来源:origin: google/j2objc

private TypeToken<?> resolveSupertype(Type type) {
 TypeToken<?> supertype = of(getCovariantTypeResolver().resolveType(type));
 // super types' type mapping is a subset of type mapping of this type.
 supertype.covariantTypeResolver = covariantTypeResolver;
 supertype.invariantTypeResolver = invariantTypeResolver;
 return supertype;
}

代码示例来源:origin: wildfly/wildfly

private TypeToken<?> resolveSupertype(Type type) {
 TypeToken<?> supertype = of(getCovariantTypeResolver().resolveType(type));
 // super types' type mapping is a subset of type mapping of this type.
 supertype.covariantTypeResolver = covariantTypeResolver;
 supertype.invariantTypeResolver = invariantTypeResolver;
 return supertype;
}

代码示例来源:origin: google/guava

private boolean isSubtypeOfParameterizedType(ParameterizedType supertype) {
 Class<?> matchedClass = of(supertype).getRawType();
 if (!someRawTypeIsSubclassOf(matchedClass)) {
  return false;
 }
 TypeVariable<?>[] typeVars = matchedClass.getTypeParameters();
 Type[] supertypeArgs = supertype.getActualTypeArguments();
 for (int i = 0; i < typeVars.length; i++) {
  Type subtypeParam = getCovariantTypeResolver().resolveType(typeVars[i]);
  // If 'supertype' is "List<? extends CharSequence>"
  // and 'this' is StringArrayList,
  // First step is to figure out StringArrayList "is-a" List<E> where <E> = String.
  // String is then matched against <? extends CharSequence>, the supertypeArgs[0].
  if (!of(subtypeParam).is(supertypeArgs[i], typeVars[i])) {
   return false;
  }
 }
 // We only care about the case when the supertype is a non-static inner class
 // in which case we need to make sure the subclass's owner type is a subtype of the
 // supertype's owner.
 return Modifier.isStatic(((Class<?>) supertype.getRawType()).getModifiers())
   || supertype.getOwnerType() == null
   || isOwnedBySubtypeOf(supertype.getOwnerType());
}

代码示例来源:origin: google/j2objc

private boolean isSubtypeOfParameterizedType(ParameterizedType supertype) {
 Class<?> matchedClass = of(supertype).getRawType();
 if (!someRawTypeIsSubclassOf(matchedClass)) {
  return false;
 }
 TypeVariable<?>[] typeVars = matchedClass.getTypeParameters();
 Type[] supertypeArgs = supertype.getActualTypeArguments();
 for (int i = 0; i < typeVars.length; i++) {
  Type subtypeParam = getCovariantTypeResolver().resolveType(typeVars[i]);
  // If 'supertype' is "List<? extends CharSequence>"
  // and 'this' is StringArrayList,
  // First step is to figure out StringArrayList "is-a" List<E> where <E> = String.
  // String is then matched against <? extends CharSequence>, the supertypeArgs[0].
  if (!of(subtypeParam).is(supertypeArgs[i], typeVars[i])) {
   return false;
  }
 }
 // We only care about the case when the supertype is a non-static inner class
 // in which case we need to make sure the subclass's owner type is a subtype of the
 // supertype's owner.
 return Modifier.isStatic(((Class<?>) supertype.getRawType()).getModifiers())
   || supertype.getOwnerType() == null
   || isOwnedBySubtypeOf(supertype.getOwnerType());
}

代码示例来源:origin: wildfly/wildfly

private boolean isSubtypeOfParameterizedType(ParameterizedType supertype) {
 Class<?> matchedClass = of(supertype).getRawType();
 if (!someRawTypeIsSubclassOf(matchedClass)) {
  return false;
 }
 TypeVariable<?>[] typeVars = matchedClass.getTypeParameters();
 Type[] supertypeArgs = supertype.getActualTypeArguments();
 for (int i = 0; i < typeVars.length; i++) {
  Type subtypeParam = getCovariantTypeResolver().resolveType(typeVars[i]);
  // If 'supertype' is "List<? extends CharSequence>"
  // and 'this' is StringArrayList,
  // First step is to figure out StringArrayList "is-a" List<E> where <E> = String.
  // String is then matched against <? extends CharSequence>, the supertypeArgs[0].
  if (!of(subtypeParam).is(supertypeArgs[i], typeVars[i])) {
   return false;
  }
 }
 // We only care about the case when the supertype is a non-static inner class
 // in which case we need to make sure the subclass's owner type is a subtype of the
 // supertype's owner.
 return Modifier.isStatic(((Class<?>) supertype.getRawType()).getModifiers())
   || supertype.getOwnerType() == null
   || isOwnedBySubtypeOf(supertype.getOwnerType());
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private TypeToken<?> resolveSupertype(Type type) {
 TypeToken<?> supertype = of(getCovariantTypeResolver().resolveType(type));
 // super types' type mapping is a subset of type mapping of this type.
 supertype.covariantTypeResolver = covariantTypeResolver;
 supertype.invariantTypeResolver = invariantTypeResolver;
 return supertype;
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

private TypeToken<?> resolveSupertype(Type type) {
 TypeToken<?> supertype = of(getCovariantTypeResolver().resolveType(type));
 // super types' type mapping is a subset of type mapping of this type.
 supertype.covariantTypeResolver = covariantTypeResolver;
 supertype.invariantTypeResolver = invariantTypeResolver;
 return supertype;
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

private boolean isSubtypeOfParameterizedType(ParameterizedType supertype) {
 Class<?> matchedClass = of(supertype).getRawType();
 if (!someRawTypeIsSubclassOf(matchedClass)) {
  return false;
 }
 TypeVariable<?>[] typeVars = matchedClass.getTypeParameters();
 Type[] supertypeArgs = supertype.getActualTypeArguments();
 for (int i = 0; i < typeVars.length; i++) {
  Type subtypeParam = getCovariantTypeResolver().resolveType(typeVars[i]);
  // If 'supertype' is "List<? extends CharSequence>"
  // and 'this' is StringArrayList,
  // First step is to figure out StringArrayList "is-a" List<E> where <E> = String.
  // String is then matched against <? extends CharSequence>, the supertypeArgs[0].
  if (!of(subtypeParam).is(supertypeArgs[i], typeVars[i])) {
   return false;
  }
 }
 // We only care about the case when the supertype is a non-static inner class
 // in which case we need to make sure the subclass's owner type is a subtype of the
 // supertype's owner.
 return Modifier.isStatic(((Class<?>) supertype.getRawType()).getModifiers())
   || supertype.getOwnerType() == null
   || isOwnedBySubtypeOf(supertype.getOwnerType());
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private boolean isSubtypeOfParameterizedType(ParameterizedType supertype) {
 Class<?> matchedClass = of(supertype).getRawType();
 if (!someRawTypeIsSubclassOf(matchedClass)) {
  return false;
 }
 TypeVariable<?>[] typeVars = matchedClass.getTypeParameters();
 Type[] supertypeArgs = supertype.getActualTypeArguments();
 for (int i = 0; i < typeVars.length; i++) {
  Type subtypeParam = getCovariantTypeResolver().resolveType(typeVars[i]);
  // If 'supertype' is "List<? extends CharSequence>"
  // and 'this' is StringArrayList,
  // First step is to figure out StringArrayList "is-a" List<E> where <E> = String.
  // String is then matched against <? extends CharSequence>, the supertypeArgs[0].
  if (!of(subtypeParam).is(supertypeArgs[i], typeVars[i])) {
   return false;
  }
 }
 // We only care about the case when the supertype is a non-static inner class
 // in which case we need to make sure the subclass's owner type is a subtype of the
 // supertype's owner.
 return Modifier.isStatic(((Class<?>) supertype.getRawType()).getModifiers())
   || supertype.getOwnerType() == null
   || isOwnedBySubtypeOf(supertype.getOwnerType());
}

相关文章

微信公众号

最新文章

更多

TypeToken类方法