Record Class JsonTruncator.TruncateConfig

java.lang.Object
java.lang.Record
cloud.opencode.base.json.util.JsonTruncator.TruncateConfig
Record Components:
maxLength - soft limit for output characters; actual output may be slightly larger due to structural closing brackets (default 1024) - 输出字符数的软限制;实际输出可能因结构闭合括号而略大(默认 1024)
maxArrayElements - maximum array items to show (default 3) - 显示的最大数组项数
maxStringLength - maximum string value characters (default 100) - 最大字符串值字符数
maxDepth - maximum nesting depth (default 5) - 最大嵌套深度
truncationMarker - the truncation marker string (default "...") - 截断标记字符串
Enclosing class:
JsonTruncator

public static record JsonTruncator.TruncateConfig(int maxLength, int maxArrayElements, int maxStringLength, int maxDepth, String truncationMarker) extends Record
Truncation configuration record. 截断配置记录。
Since:
JDK 25, opencode-base-json V1.0.3
Author:
Leon Soo www.LeonSoo.com
  • Field Details

  • Constructor Details

    • TruncateConfig

      public TruncateConfig(int maxLength, int maxArrayElements, int maxStringLength, int maxDepth, String truncationMarker)
      Validates the configuration parameters. 验证配置参数。
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxLength

      public int maxLength()
      Returns the value of the maxLength record component.
      Returns:
      the value of the maxLength record component
    • maxArrayElements

      public int maxArrayElements()
      Returns the value of the maxArrayElements record component.
      Returns:
      the value of the maxArrayElements record component
    • maxStringLength

      public int maxStringLength()
      Returns the value of the maxStringLength record component.
      Returns:
      the value of the maxStringLength record component
    • maxDepth

      public int maxDepth()
      Returns the value of the maxDepth record component.
      Returns:
      the value of the maxDepth record component
    • truncationMarker

      public String truncationMarker()
      Returns the value of the truncationMarker record component.
      Returns:
      the value of the truncationMarker record component