[BEAM-2166] Split Coder's encode/decode methods into two methods depending on context.#2871
[BEAM-2166] Split Coder's encode/decode methods into two methods depending on context.#2871robertwb wants to merge 3 commits intoapache:masterfrom
Conversation
…text. This allows the outer context to be marked deprecated. A follow-up PR will remove the old method once all consumers have been updated.
|
R: @lukecwik |
| return builder.toString(); | ||
| } | ||
|
|
||
| public void encode(T value, OutputStream outStream) |
There was a problem hiding this comment.
Add default implementations of:
- encode(T, OutputStream, Context) that calls the appropriate encode(T, OutputStream)/encodeOuter(T, OutputStream) methods.
- decode(InputStream, Context) that calls the appropriate decode(InputStream)/decodeOuter(InputStream) methods.
This way we can remove the base method as soon as everyone has migrated to implementing the non context versions.
Also, we should have:
- encodeOuter(T, OutputStream) call encode(T, OutputStream)
- decodeOuter(InputStream) call decode(InputStream)
This way only Coders where outer context is important will need to implement it.
There was a problem hiding this comment.
Implemented the base encode/decode methods (though this opens us up to infinite recursion and no abstract methods, it should be short term). However, it's unsafe to unconditionally delegate the Outer ones to nested until everything is migrated.
|
There should probably be a JIRA and a discussion. Do the other methods that take context (e.g., estimating byte size) need to be updated too? |
|
JIRA filed. Added non-context versions of size estimation. Didn't add an Outer version, as these are estimations and context doesn't ever seem to be actually inspected for nearly any leaf Coders. |
|
retest this please |
|
LGTM |
…text.
This allows the outer context to be marked deprecated. A follow-up PR will
remove the old method once all consumers have been updated.
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
[BEAM-<Jira issue #>] Description of pull requestmvn clean verify.<Jira issue #>in the title with the actual Jira issuenumber, if there is one.
Individual Contributor License Agreement.