protected static class TypeConformanceComputer.MaxDistanceRawTypeAcceptor extends java.lang.Object implements SuperTypeCollector.SuperTypeAcceptor
Multiset
with the maximum number of necessary steps
from a given type to its super types. Sorting the set by the steps creates
a stable order on from the direct super class, the most specialized implemented
interfaces up to object.
E.g. although StringBuilder
implements Serializable
and
CharSequence
, serializable is treated as more specific by this algorithm
since the super class AbstractStringBuilder implements CharSequence
, too.
Thus the number of steps to Serializable
is 1
while
CharSequence
requires 2
hops.Modifier | Constructor and Description |
---|---|
protected |
TypeConformanceComputer.MaxDistanceRawTypeAcceptor(com.google.common.collect.Multiset<JvmType> result,
com.google.common.collect.Multimap<JvmType,JvmTypeReference> all,
com.google.common.base.Function<JvmTypeReference,JvmTypeReference> resolver) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(JvmTypeReference superType,
int distance) |
protected TypeConformanceComputer.MaxDistanceRawTypeAcceptor(com.google.common.collect.Multiset<JvmType> result, com.google.common.collect.Multimap<JvmType,JvmTypeReference> all, com.google.common.base.Function<JvmTypeReference,JvmTypeReference> resolver)
public boolean accept(JvmTypeReference superType, int distance)
accept
in interface SuperTypeCollector.SuperTypeAcceptor
superType
- a found super typedistance
- the distance to the starting type. StringBuilder has a distance 1 to
AbstractStringBuilder, distance 1 and 2 to CharSequence and distance 2 to Appendable.