@UnstableApi
public final class Dumper


Helper utility to dump field values.

Summary

Nested types

public interface Dumper.Dumpable

Provides custom dump method.

Public constructors

Public methods

Dumper
Dumper
Dumper
@CanIgnoreReturnValue
add(String field, byte[] value)
Dumper
@CanIgnoreReturnValue
addIfNonDefault(
    String field,
    @Nullable Object value,
    @Nullable Object defaultValue
)

Calls add if value is not equal to defaultValue.

Dumper
@CanIgnoreReturnValue
<T> addIfNonDefault(
    String field,
    T value,
    T defaultValue,
    Function<T, Object> valueTransformFunction
)

Applies valueTransformFunction to value and defaultValue and passes the results to addIfNonDefault.

Dumper
@CanIgnoreReturnValue
addTime(String field, long time)
Dumper
Dumper
String

Public constructors

Dumper

public Dumper()

Public methods

add

@CanIgnoreReturnValue
public Dumper add(String field, Object value)

add

@CanIgnoreReturnValue
public Dumper add(String field, byte[] value)

addIfNonDefault

@CanIgnoreReturnValue
public Dumper addIfNonDefault(
    String field,
    @Nullable Object value,
    @Nullable Object defaultValue
)

Calls add if value is not equal to defaultValue.

It is not permitted to pass a null value to add, so null is only permitted here as a default value. Passing value == null && defaultValue != null will result in a .

addIfNonDefault

@CanIgnoreReturnValue
public Dumper <T> addIfNonDefault(
    String field,
    T value,
    T defaultValue,
    Function<T, Object> valueTransformFunction
)

Applies valueTransformFunction to value and defaultValue and passes the results to addIfNonDefault.

See addIfNonDefault for limitations around when null results from valueTransformFunction are permitted.

addTime

@CanIgnoreReturnValue
public Dumper addTime(String field, long time)

endBlock

@CanIgnoreReturnValue
public Dumper endBlock()

startBlock

@CanIgnoreReturnValue
public Dumper startBlock(String name)

toString

public String toString()