@@ -89,7 +89,7 @@ static Builder newBuilder() {
8989 /**
9090 * Return json content for the given object.
9191 * <p>
92- * This is a convenience method for using {@code jsonb.type(Object.class).toJson(any) }
92+ * This is a convenience method for {@code jsonb.type(Object.class).toJson(any) }
9393 *
9494 * @param any The object to return as json string
9595 * @return Return json content for the given object.
@@ -99,28 +99,61 @@ static Builder newBuilder() {
9999 /**
100100 * Return json content in pretty format for the given object.
101101 * <p>
102- * This is a convenience method for using {@code jsonb.type(Object.class).toJsonPretty(any) }
102+ * This is a convenience method for {@code jsonb.type(Object.class).toJsonPretty(any) }
103103 *
104104 * @param any The object to return as json string in pretty format
105105 * @return Return json content in pretty format for the given object.
106106 */
107107 String toJsonPretty (Object any );
108108
109+ /**
110+ * Return the value as json content in bytes form.
111+ * <p>
112+ * This is a convenience method for {@code jsonb.type(Object.class).toJsonBytes(any) }
113+ */
114+ byte [] toJsonBytes (Object any );
115+
116+ /**
117+ * Write to the given writer.
118+ * <p>
119+ * This is a convenience method for {@code jsonb.type(Object.class).toJson(any, writer) }
120+ */
121+ void toJson (Object any , Writer writer );
122+
123+ /**
124+ * Write to the given outputStream.
125+ * <p>
126+ * This is a convenience method for {@code jsonb.type(Object.class).toJsonBytes(any, outputStream) }
127+ */
128+ void toJson (Object any , OutputStream outputStream );
129+
109130 /**
110131 * Return the JsonType used to read and write json for the given class.
111132 *
112- * <h3>Examples </h3>
133+ * <h3>fromJson() example </h3>
113134 * <pre>{@code
114135 *
115- * JsonType<Customer> customerType = jsonb.type(Customer.class)
136+ * Customer customer = jsonb
137+ * .type(Customer.class)
138+ * .fromJson(jsonContent);
116139 *
117- * Customer customer = ...
118- * customerType.toJson(customer);
119140 *
120- * JsonType<List<Customer>> customerListType = customerType.list()
141+ * // list
142+ * List<Customer> customers = jsonb
143+ * .type(Customer.class)
144+ * .list()
145+ * .fromJson(jsonContent);
146+ *
147+ * }</pre>
148+ *
149+ * <h3>toJson() example</h3>
150+ * <pre>{@code
151+ *
152+ * Customer customer = ...
121153 *
122- * List<Customer> customers = ...
123- * customerListType.toJson(customers);
154+ * String jsonContent = jsonb
155+ * .type(Customer.class)
156+ * .toJson(customer);
124157 *
125158 * }</pre>
126159 *
@@ -129,6 +162,21 @@ static Builder newBuilder() {
129162 * We can use <code>type(Object.class)</code> when we don't know the specific type that is being
130163 * written toJson or read fromJson.
131164 * <p>
165+ *
166+ * <h3>Object toJson()</h3>
167+ * <pre>{@code
168+ *
169+ * Object any = ...
170+ *
171+ * String jsonContent = jsonb
172+ * .type(Object.class)
173+ * .toJson(any);
174+ *
175+ * // the same as
176+ * String jsonContent = jsonb.toJson(any);
177+ *
178+ * }</pre>
179+ * <p>
132180 * When using <code>Object.class</code> and writing <code>toJson()</code> then the underlying JsonAdapter
133181 * is determined dynamically based on the type of the object value passed in.
134182 * <p>
@@ -158,6 +206,20 @@ static Builder newBuilder() {
158206 * <p>
159207 * We can use <code>type(Object.class)</code> when we don't know the specific type that is being
160208 * written toJson or read fromJson.
209+ *
210+ * <h3>Object toJson()</h3>
211+ * <pre>{@code
212+ *
213+ * Object any = ...
214+ *
215+ * String jsonContent = jsonb
216+ * .type(Object.class)
217+ * .toJson(any);
218+ *
219+ * // the same as
220+ * String jsonContent = jsonb.toJson(any);
221+ *
222+ * }</pre>
161223 * <p>
162224 * When using <code>Object.class</code> and writing <code>toJson()</code> then the underlying JsonAdapter
163225 * is determined dynamically based on the type of the object value passed in.
0 commit comments