Adds support for writing binary Ion 1.1 data.#1
Conversation
popematt
left a comment
There was a problem hiding this comment.
LGTM. I've got a couple questions, but nothing that would block the PR.
|
|
||
| /** | ||
| * Whether to use the Ion 1.1 encoding (true) or the Ion 1.0 encoding (false). Disabled by default. | ||
| * | ||
| * @since 2.18 // TODO change according to the minor version this lands in. | ||
| */ | ||
| ION_VERSION_1_1(false), |
There was a problem hiding this comment.
Is it possible to set something up so that instead of it being true/false, we have a "feature" that can accept an Ion Version enum?
There was a problem hiding this comment.
That's what I'd prefer too (see my comment in the PR description), but I haven't seen an example of that yet within Jackson. These enums implement a Jackson core interface so that they can be used in various places in that code, and so far I've only seen them set by booleans. I'll keep looking though.
| ctxt.setEncoding(enc); | ||
| ion = _system.newBinaryWriter(out); | ||
| if (IonGenerator.Feature.ION_VERSION_1_1.enabledIn(_ionGeneratorFeatures)) { | ||
| ion = IonEncodingVersion.ION_1_1.binaryWriterBuilder().build(out); |
There was a problem hiding this comment.
I'm guessing the answer is "no", but does the IonObjectMapper allow you to provide your own IonWriterBuilder either when configuring the mapper or writing a value?
There was a problem hiding this comment.
You can achieve this in a few ways:
- You can create an IonObjectMapper using an IonFactory. You can provide an IonSystem to an IonFactory. You can provide text or binary writer builders to an IonSystem.
- You can provide an IonWriter instance to an IonGenerator or to
IonObjectMapper.writeValue.
Basic support for binary Ion 1.1. Support for Ion 1.1 text will come later. The boolean feature flag isn't my favorite, but I haven't yet found a better way that fits with Jackson's conventions (though that doesn't mean there isn't one).