File tree 1 file changed +29
-0
lines changed
java/util/src/main/java/com/google/protobuf/util
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,35 @@ public Printer usingTypeRegistry(com.google.protobuf.TypeRegistry registry) {
178
178
sortingMapKeys );
179
179
}
180
180
181
+ /**
182
+ * Creates a new {@link Printer} that will always print fields unless they are a message type or
183
+ * in a oneof.
184
+ *
185
+ * <p>Note that this does print Proto2 Optional but does not print Proto3 Optional fields, as
186
+ * the latter is represented using a synthetic oneof.
187
+ *
188
+ * <p>The new Printer clones all other configurations from the current {@link Printer}.
189
+ *
190
+ * @deprecated This method is deprecated, and slated for removal in the next Java breaking
191
+ * change (5.x). Prefer {@link #alwaysPrintFieldsWithNoPresence}
192
+ */
193
+ @ Deprecated
194
+ public Printer includingDefaultValueFields () {
195
+ if (shouldPrintDefaults != ShouldPrintDefaults .ONLY_IF_PRESENT ) {
196
+ throw new IllegalStateException (
197
+ "JsonFormat includingDefaultValueFields has already been set." );
198
+ }
199
+ return new Printer (
200
+ registry ,
201
+ oldRegistry ,
202
+ ShouldPrintDefaults .ALWAYS_PRINT_EXCEPT_MESSAGES_AND_ONEOFS ,
203
+ ImmutableSet .of (),
204
+ preservingProtoFieldNames ,
205
+ omittingInsignificantWhitespace ,
206
+ printingEnumsAsInts ,
207
+ sortingMapKeys );
208
+ }
209
+
181
210
/**
182
211
* Creates a new {@link Printer} that will also print default-valued fields if their
183
212
* FieldDescriptors are found in the supplied set. Empty repeated fields and map fields will be
You can’t perform that action at this time.
0 commit comments