Package-level declarations

This package contains extensions to Guava's base module.

ToStringHelper

Guava ToStringHelper

Adds several extension functions for ToStringHelper, to make it more idiomatic in kotlin.

See the Guava User Guide on writing Object methods with com.google.common.base.Objects

Splitter as a Flow

Extension function for Splitter that allows it to be consumed as a flow.

To use this, you must include kotlinx-coroutines-core and kotlinx-coroutines-jdk8 as dependencies.

Throwables

Guava Throwables

Adds several extension functions to Throwable that delegate to Guava's Throwables

Functions

Link copied to clipboard

Converts the CaseFormat of a string.

Link copied to clipboard
inline fun <X : Throwable> Throwable.getCauseAs(): X?

Returns this's cause, cast to X.

Link copied to clipboard

Returns the innermost cause of this. The first throwable in a chain provides context from when the error or exception was initially detected. Example usage:

Link copied to clipboard

Propagates this exactly as-is, if and only if it is an instance of RuntimeException, Error, or X. Example usage:

Link copied to clipboard
inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Any)

Adds a name/value pair to the formatted output in name=value format.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Boolean)

Adds a name/value pair to the formatted output in name=value format, for the boolean primitive type.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Char)

Adds a name/value pair to the formatted output in name=value format, for the char primitive type.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Double)

Adds a name/value pair to the formatted output in name=value format, for the double primitive type.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Float)

Adds a name/value pair to the formatted output in name=value format, for the float primitive type.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Int)

Adds a name/value pair to the formatted output in name=value format, for the int primitive type.

inline operator fun MoreObjects.ToStringHelper.set(name: String, value: Long)

Adds a name/value pair to the formatted output in name=value format, for the long primitive type.

Link copied to clipboard

Splits sequence into string components and makes them available through a Flow, which may be lazily evaluated. If you want an eagerly computed List, use Splitter.splitToList.

Link copied to clipboard

Throws this if it is not null and an instance of X. Example usage:

Link copied to clipboard

Throws this if it is not null and a RuntimeException or Error. Example usage:

Link copied to clipboard

Creates an instance of ToStringHelper.

Properties

Link copied to clipboard

Gets a Throwable cause chain as a list. The first entry in the list will be this followed by its cause hierarchy. Note that this is a snapshot of the cause chain and will not reflect any subsequent changes to the cause chain.

Link copied to clipboard

Returns a string containing the result of toString(), followed by the full, recursive stack trace of this. Note that you probably should not be parsing the resulting string; if you need programmatic access to the stack frames, you can call Throwable.getStackTrace.