本文整理了Java中com.google.common.reflect.TypeToken.getCovariantTypeResolver()
方法的一些代码示例,展示了TypeToken.getCovariantTypeResolver()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TypeToken.getCovariantTypeResolver()
方法的具体详情如下:
包路径:com.google.common.reflect.TypeToken
类名称: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());
}
内容来源于网络,如有侵权,请联系作者删除!