Package software.amazon.smithy.utils
Class CycleException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
software.amazon.smithy.utils.CycleException
- All Implemented Interfaces:
Serializable
Signals that one or more cycles have been detected when attempting to topologically
sort shapes in a
DependencyGraph.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCycleException(List<T> sortedNodes, Set<T> cyclicNodes) Constructs a CycleException. -
Method Summary
Modifier and TypeMethodDescription<T> Set<T>getCyclicNodes(Class<T> expectedNodeType) Gets the set of nodes that are part of a cycle.<T> List<T>getSortedNodes(Class<T> expectedNodeType) Gets the list of nodes that could be sorted.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CycleException
Constructs a CycleException.- Type Parameters:
T- The type of the node.- Parameters:
sortedNodes- A list of the nodes that were sorted successfully.cyclicNodes- A set of nodes that could not be sorted due to being part of a cycle.
-
-
Method Details
-
getCyclicNodes
Gets the set of nodes that are part of a cycle.This contains all nodes that are a part of any cycles. To see a list of individual cycles, use
DependencyGraph.findCycles().- Type Parameters:
T- The type of the graph's nodes.- Parameters:
expectedNodeType- The expected type of the node, which will be checked to be compatible with the actual type. This is necessary because exceptions can't be generic.- Returns:
- Returns a set of cyclic nodes.
-
getSortedNodes
Gets the list of nodes that could be sorted.- Type Parameters:
T- The type of the graph's nodes.- Parameters:
expectedNodeType- The expected type of the node, which will be checked to be compatible with the actual type. This is necessary because exceptions can't be generic.- Returns:
- Returns the sorted list of non-cyclic nodes.
-