Package software.amazon.awssdk.utils
Class ToString
- java.lang.Object
-
- software.amazon.awssdk.utils.ToString
-
@NotThreadSafe public final class ToString extends Object
A class to standardize implementations ofObject.toString()across the SDK.ToString.builder("Person") .add("name", name) .add("age", age) .build();
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ToStringadd(String fieldName, Object field)Add a field to the to-string result.Stringbuild()Convert this result to a string.static ToStringbuilder(String className)Create a to-string result builder for the given class name.static Stringcreate(String className)Create a to-string result for the given class name.
-
-
-
Method Detail
-
create
public static String create(String className)
Create a to-string result for the given class name.
-
builder
public static ToString builder(String className)
Create a to-string result builder for the given class name.- Parameters:
className- The name of the class being toString'd
-
add
public ToString add(String fieldName, Object field)
Add a field to the to-string result.- Parameters:
fieldName- The name of the field. Must not be null.field- The value of the field. Value is ignored if null.
-
build
public String build()
Convert this result to a string. The behavior of calling other methods after this one is undefined.
-
-