Package spoon.support.visitor
Class SubInheritanceHierarchyResolver
java.lang.Object
spoon.support.visitor.SubInheritanceHierarchyResolver
Expects a
The repeated processing of this mapping function on the same input returns only newly found sub types. The instance of
CtPackage
as input
and upon calls to forEachSubTypeInPackage produces all sub classes and sub interfaces,
which extends or implements super type(s) provided by call(s) of addSuperType(CtTypeInformation)
and stored as `targetSuperTypes`.The repeated processing of this mapping function on the same input returns only newly found sub types. The instance of
SubInheritanceHierarchyResolver
returns found sub types only once.
So repeated call with same input package returns nothing.
Create and use new instance of SubInheritanceHierarchyResolver
if you need to scan the subtype hierarchy again.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddSuperType(CtTypeInformation superType)
Add another super type to this mapping function.failOnClassNotFound(boolean failOnClassNotFound)
<T extends CtType<?>>
voidforEachSubTypeInPackage(CtConsumer<T> outputConsumer)
Calls `outputConsumer.apply(subType)` for each sub type of the targetSuperTypes that are found in `inputPackage`.includingInterfaces(boolean includingInterfaces)
-
Constructor Details
-
SubInheritanceHierarchyResolver
-
-
Method Details
-
addSuperType
Add another super type to this mapping function. Using this function you can search parallel in more sub type hierarchies.- Parameters:
superType
- - the type whose sub types will be returned by this mapping function too.
-
includingInterfaces
- Parameters:
includingInterfaces
- if false then interfaces are not visited - only super classes. By default it is true.
-
failOnClassNotFound
- Parameters:
failOnClassNotFound
- sets whether processing should throw an exception if class is missing in noClassPath mode
-
forEachSubTypeInPackage
Calls `outputConsumer.apply(subType)` for each sub type of the targetSuperTypes that are found in `inputPackage`. Each sub type is returned only once. It makes sense to call this method again for example after new super types are added byaddSuperType(CtTypeInformation)
. If this method is called again with same input and configuration, nothing in sent to outputConsumer- Parameters:
outputConsumer
- the consumer for found sub types
-