Class NoPathException

All Implemented Interfaces:
OpenExceptionMeta, Serializable

public class NoPathException extends GraphException
No Path Exception 无路径异常

Exception thrown when no path exists between two vertices.

当两个顶点之间不存在路径时抛出的异常。

Features | 主要功能:

  • Carries source and target vertex information - 携带源顶点和目标顶点信息
  • Extends GraphException with GraphErrorCode.NO_PATH - 使用NO_PATH错误码扩展GraphException

Usage Examples | 使用示例:

try {
    // operation requiring path existence
} catch (NoPathException e) {
    Object source = e.getSource();
    Object target = e.getTarget();
}

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-graph V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • NoPathException

      public NoPathException(Object source, Object target)
      Create no path exception 创建无路径异常
      Parameters:
      source - the source vertex | 源顶点
      target - the target vertex | 目标顶点
  • Method Details

    • getSource

      public Object getSource()
      Get the source vertex 获取源顶点
      Returns:
      source vertex | 源顶点
    • getTarget

      public Object getTarget()
      Get the target vertex 获取目标顶点
      Returns:
      target vertex | 目标顶点