Class YmlPlaceholderException

All Implemented Interfaces:
OpenExceptionMeta, Serializable

public class YmlPlaceholderException extends OpenYmlException
YAML Placeholder Exception - Thrown when placeholder resolution fails YAML 占位符异常 - 当占位符解析失败时抛出

This exception is thrown when a placeholder cannot be resolved.

当占位符无法解析时抛出此异常。

Features | 主要功能:

  • Tracks the unresolved placeholder expression - 跟踪未解析的占位符表达式
  • Circular reference detection - 循环引用检测
  • Error code YML_PLACEHOLDER_001 - 错误码 YML_PLACEHOLDER_001

Usage Examples | 使用示例:

try {
    resolver.resolve("${MISSING_KEY}");
} catch (YmlPlaceholderException e) {
    System.err.println("Unresolved: " + e.getPlaceholder());
}

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构建后不可变)
  • Null-safe: No (placeholder may be null) - 空值安全: 否(占位符可能为空)
Since:
JDK 25, opencode-base-yml V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • YmlPlaceholderException

      public YmlPlaceholderException(String placeholder)
      Constructs a placeholder exception for unresolved placeholder. 为未解析的占位符构造异常。
      Parameters:
      placeholder - the unresolved placeholder | 未解析的占位符
    • YmlPlaceholderException

      public YmlPlaceholderException(String placeholder, String message)
      Constructs a placeholder exception with message. 构造带消息的占位符异常。
      Parameters:
      placeholder - the placeholder | 占位符
      message - the detail message | 详细消息
    • YmlPlaceholderException

      public YmlPlaceholderException(String placeholder, String message, Throwable cause)
      Constructs a placeholder exception with message and cause. 构造带消息和原因的占位符异常。
      Parameters:
      placeholder - the placeholder | 占位符
      message - the detail message | 详细消息
      cause - the cause | 原因
  • Method Details

    • getPlaceholder

      public String getPlaceholder()
      Gets the placeholder that caused the exception. 获取导致异常的占位符。
      Returns:
      the placeholder | 占位符
    • circularReference

      public static YmlPlaceholderException circularReference(String placeholder)
      Creates an exception for circular reference. 为循环引用创建异常。
      Parameters:
      placeholder - the placeholder | 占位符
      Returns:
      the exception | 异常