MCPcopy Create free account
hub / github.com/antlr/codebuff / getGenericInterfaces

Method getGenericInterfaces

output/java_guava/1.4.17/TypeToken.java:336–350  ·  view source on GitHub ↗

Returns the generic interfaces that this type directly implements. This method is similar but different from Class#getGenericInterfaces(). For example, new TypeToken >() {.getGenericInterfaces()} will return a list that contains {@code new TypeToken<Iterable<Strin

()

Source from the content-addressed store, hash-verified

334 */
335
336 final ImmutableList<TypeToken<? super T>> getGenericInterfaces() {
337 if (runtimeType instanceof TypeVariable) {
338 return boundsAsInterfaces(((TypeVariable<?>) runtimeType).getBounds());
339 }
340 if (runtimeType instanceof WildcardType) {
341 return boundsAsInterfaces(((WildcardType) runtimeType).getUpperBounds());
342 }
343 ImmutableList.Builder<TypeToken<? super T>> builder = ImmutableList.builder();
344 for (Type interfaceType : getRawType().getGenericInterfaces()) {
345 @SuppressWarnings("unchecked") // interface of T
346 TypeToken<? super T> resolvedInterface = (TypeToken<? super T>) resolveSupertype(interfaceType);
347 builder.add(resolvedInterface);
348 }
349 return builder.build();
350 }
351
352
353 private ImmutableList<TypeToken<? super T>> boundsAsInterfaces(Type[] bounds) {

Callers 2

getInterfacesMethod · 0.45
visitClassMethod · 0.45

Calls 8

boundsAsInterfacesMethod · 0.95
builderMethod · 0.95
getRawTypeMethod · 0.95
resolveSupertypeMethod · 0.95
addMethod · 0.65
getBoundsMethod · 0.45
getUpperBoundsMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected