Package software.amazon.smithy.utils
Class CodeWriterDebugInfo
- java.lang.Object
-
- software.amazon.smithy.utils.CodeWriterDebugInfo
-
public final class CodeWriterDebugInfo extends java.lang.Object
Provides debug information about the current state of a CodeWriter.The primary use case of this class is to be included in things like exception messages thrown by
CodeWriter
. Additional metadata can be appended to the debug info by callingputMetadata(java.lang.String, java.lang.String)
, and this metadata will appear whentoString()
is called.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getMetadata(java.lang.String key)
Gets debug metadata by name.java.lang.String
getStateDebugPath()
Get the CodeWriter state path from which the debug information was collected.void
putMetadata(java.lang.String key, java.lang.String value)
Put additional debug metadata on the object.java.lang.String
toString()
Returns a string representation that can be used in exception messages and when debugging.
-
-
-
Method Detail
-
getStateDebugPath
public java.lang.String getStateDebugPath()
Get the CodeWriter state path from which the debug information was collected.- Returns:
- Returns the path as returned by
AbstractCodeWriter.getDebugInfo()
;
-
putMetadata
public void putMetadata(java.lang.String key, java.lang.String value)
Put additional debug metadata on the object.- Parameters:
key
- Name of the value to set.value
- Value to set that cannot be null.
-
getMetadata
public java.lang.String getMetadata(java.lang.String key)
Gets debug metadata by name.- Parameters:
key
- Value to retrieve.- Returns:
- Returns the string value or null if not found.
-
toString
public java.lang.String toString()
Returns a string representation that can be used in exception messages and when debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Returns debug info as a string.
-
-