FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

Add `IonObjectMapper.builderForBinaryWriters()` / `.builderforTextualWriters()` convenience methods #246

Closed cowtowncoder closed 3 years ago

cowtowncoder commented 3 years ago

Currently IonFactory has methods for specifying whether binary- or textual-output should be specified. While this can be used via IonObjectMapper by specifying builder for IonFactory, this is bit unwieldy:

ObjectMapper mapper = IonObjectMapper.builder(
  IonFactory.builderForBinaryWriters().build()
)
// possibly configure and
.build();

and it'd make sense to add short-cuts to allow:

ObjectMapper mapper = IonObjectMapper.builderForBinaryWriters()
   .build();

Should also add Javadocs for existing builder() methods to indicate that the default is to use binary writers.

cowtowncoder commented 3 years ago

As per discussion, added in 2.12.2 as it's bit of a "special" release anyway :)