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

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

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

TypeToken.getRawTypes介绍

暂无

代码示例

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

private boolean someRawTypeIsSubclassOf(Class<?> superclass) {
 for (Class<?> rawType : getRawTypes()) {
  if (superclass.isAssignableFrom(rawType)) {
   return true;
  }
 }
 return false;
}

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

private boolean someRawTypeIsSubclassOf(Class<?> superclass) {
 for (Class<?> rawType : getRawTypes()) {
  if (superclass.isAssignableFrom(rawType)) {
   return true;
  }
 }
 return false;
}

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

private boolean someRawTypeIsSubclassOf(Class<?> superclass) {
 for (Class<?> rawType : getRawTypes()) {
  if (superclass.isAssignableFrom(rawType)) {
   return true;
  }
 }
 return false;
}

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

/**
 * Returns the raw type of {@code T}. Formally speaking, if {@code T} is returned by {@link
 * java.lang.reflect.Method#getGenericReturnType}, the raw type is what's returned by {@link
 * java.lang.reflect.Method#getReturnType} of the same method object. Specifically:
 *
 * <ul>
 *   <li>If {@code T} is a {@code Class} itself, {@code T} itself is returned.
 *   <li>If {@code T} is a {@link ParameterizedType}, the raw type of the parameterized type is
 *       returned.
 *   <li>If {@code T} is a {@link GenericArrayType}, the returned type is the corresponding array
 *       class. For example: {@code List<Integer>[] => List[]}.
 *   <li>If {@code T} is a type variable or a wildcard type, the raw type of the first upper bound
 *       is returned. For example: {@code <X extends Foo> => Foo}.
 * </ul>
 */
public final Class<? super T> getRawType() {
 // For wildcard or type variable, the first bound determines the runtime type.
 Class<?> rawType = getRawTypes().iterator().next();
 @SuppressWarnings("unchecked") // raw type is |T|
 Class<? super T> result = (Class<? super T>) rawType;
 return result;
}

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

/**
 * Returns the raw type of {@code T}. Formally speaking, if {@code T} is returned by {@link
 * java.lang.reflect.Method#getGenericReturnType}, the raw type is what's returned by {@link
 * java.lang.reflect.Method#getReturnType} of the same method object. Specifically:
 *
 * <ul>
 *   <li>If {@code T} is a {@code Class} itself, {@code T} itself is returned.
 *   <li>If {@code T} is a {@link ParameterizedType}, the raw type of the parameterized type is
 *       returned.
 *   <li>If {@code T} is a {@link GenericArrayType}, the returned type is the corresponding array
 *       class. For example: {@code List<Integer>[] => List[]}.
 *   <li>If {@code T} is a type variable or a wildcard type, the raw type of the first upper bound
 *       is returned. For example: {@code <X extends Foo> => Foo}.
 * </ul>
 */
public final Class<? super T> getRawType() {
 // For wildcard or type variable, the first bound determines the runtime type.
 Class<?> rawType = getRawTypes().iterator().next();
 @SuppressWarnings("unchecked") // raw type is |T|
 Class<? super T> result = (Class<? super T>) rawType;
 return result;
}

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

/**
 * Returns the raw type of {@code T}. Formally speaking, if {@code T} is returned by {@link
 * java.lang.reflect.Method#getGenericReturnType}, the raw type is what's returned by {@link
 * java.lang.reflect.Method#getReturnType} of the same method object. Specifically:
 *
 * <ul>
 *   <li>If {@code T} is a {@code Class} itself, {@code T} itself is returned.
 *   <li>If {@code T} is a {@link ParameterizedType}, the raw type of the parameterized type is
 *       returned.
 *   <li>If {@code T} is a {@link GenericArrayType}, the returned type is the corresponding array
 *       class. For example: {@code List<Integer>[] => List[]}.
 *   <li>If {@code T} is a type variable or a wildcard type, the raw type of the first upper bound
 *       is returned. For example: {@code <X extends Foo> => Foo}.
 * </ul>
 */
public final Class<? super T> getRawType() {
 // For wildcard or type variable, the first bound determines the runtime type.
 Class<?> rawType = getRawTypes().iterator().next();
 @SuppressWarnings("unchecked") // raw type is |T|
 Class<? super T> result = (Class<? super T>) rawType;
 return result;
}

代码示例来源:origin: com.google.guava/guava-jdk5

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

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

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Returns the raw type of the class or parameterized type; if {@code T} is type variable or
 * wildcard type, the raw types of all its upper bounds are returned.
 */
private ImmutableSet<Class<? super T>> getImmediateRawTypes() {
 // Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
 @SuppressWarnings({"unchecked", "rawtypes"})
 ImmutableSet<Class<? super T>> result = (ImmutableSet) getRawTypes(runtimeType);
 return result;
}

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

private boolean someRawTypeIsSubclassOf(Class<?> superclass) {
 for (Class<?> rawType : getRawTypes()) {
  if (superclass.isAssignableFrom(rawType)) {
   return true;
  }
 }
 return false;
}

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

private boolean someRawTypeIsSubclassOf(Class<?> superclass) {
 for (Class<?> rawType : getRawTypes()) {
  if (superclass.isAssignableFrom(rawType)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

private static ImmutableSet<Class<?>> getRawTypes(Type[] types) {
 ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder();
 for (Type type : types) {
  builder.addAll(getRawTypes(type));
 }
 return builder.build();
}

代码示例来源:origin: com.google.guava/guava-jdk5

@VisibleForTesting static Class<?> getRawType(Type type) {
 // For wildcard or type variable, the first bound determines the runtime type.
 return getRawTypes(type).iterator().next();
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

@VisibleForTesting static Class<?> getRawType(Type type) {
 // For wildcard or type variable, the first bound determines the runtime type.
 return getRawTypes(type).iterator().next();
}

代码示例来源:origin: Nextdoor/bender

@VisibleForTesting static Class<?> getRawType(Type type) {
 // For wildcard or type variable, the first bound determines the runtime type.
 return getRawTypes(type).iterator().next();
}

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

@VisibleForTesting static Class<?> getRawType(Type type) {
 // For wildcard or type variable, the first bound determines the runtime type.
 return getRawTypes(type).iterator().next();
}

相关文章

微信公众号

最新文章

更多

TypeToken类方法