Package software.amazon.smithy.utils
Class CodeWriterDebugInfo
java.lang.Object
software.amazon.smithy.utils.CodeWriterDebugInfo
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 calling putMetadata(java.lang.String, java.lang.String)
,
and this metadata will appear when toString()
is called.
-
Method Summary
Modifier and TypeMethodDescriptiongetMetadata
(String key) Gets debug metadata by name.Get the CodeWriter state path from which the debug information was collected.void
putMetadata
(String key, String value) Put additional debug metadata on the object.toString()
Returns a string representation that can be used in exception messages and when debugging.
-
Method Details
-
getStateDebugPath
Get the CodeWriter state path from which the debug information was collected.- Returns:
- Returns the path as returned by
AbstractCodeWriter.getDebugInfo()
;
-
putMetadata
Put additional debug metadata on the object.- Parameters:
key
- Name of the value to set.value
- Value to set that cannot be null.
-
getMetadata
Gets debug metadata by name.- Parameters:
key
- Value to retrieve.- Returns:
- Returns the string value or null if not found.
-
toString
Returns a string representation that can be used in exception messages and when debugging.
-