DefaultTextObjectFormatter

Formats an object by using its toString representation, its Class.getName and its System.identityHashCode (in most cases).

Some objects are treated differently, refer to format for details.

The aim of representing more information than just toString is to avoid situations where an assert may fail and toString does not distinguish two compared objects. Consider the following error message "error, assert: 1 to be 1" would not be very helpful. "error, assert: 1 (Int <123>) to be 1 (Double <456>)" on the other hand is helpful.

Parameters

translator

The Translator used to translate Translatables.

Constructors

Link copied to clipboard
expect constructor(translator: Translator)
actual constructor(translator: Translator)
actual constructor(translator: Translator)

Formats an object by using its toString representation, its Class.getName and its System.identityHashCode (in most cases).

Functions

Link copied to clipboard
abstract fun format(value: Any?): String

Returns a formatted version of the given value.

open override fun format(value: Any?): String

Returns a formatted version of the given value.

override fun format(value: Any?): String

Returns a formatted version of the given value.