+ /**
+ * Append a named value to a ToStringHelper. If the value is null, this method does nothing.
+ *
+ * @param helper Helper to append to
+ * @param name Name of the value
+ * @param value Value to append
+ * @throws NullPointerException if the name or helper is null
+ */
+ public static void appendValue(final @NonNull ToStringHelper helper, final @NonNull String name,
+ final @Nullable Object value) {
+ if (value != null) {
+ helper.add(name, value);
+ }
+ }
+
+ /**
+ * Append a named value to a ToStringHelper. If the value is null, this method does nothing.
+ *
+ * @param helper Helper to append to
+ * @param name Name of the value
+ * @param value Value to append
+ * @throws NullPointerException if the name or helper is null
+ */
+ public static void appendValue(final ToStringHelper helper, final String name, final byte[] value) {
+ if (value != null) {
+ helper.add(name, Arrays.toString(value));
+ }
+ }
+