Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-59] Switch mimeType from mutable protected field to constructor #2793

Closed
wants to merge 2 commits into from

Conversation

dhalperi
Copy link
Contributor

@dhalperi dhalperi commented Apr 30, 2017

Protected mutable fields are a terrible design pattern, and this
information is known at construction time.

Also fix a minor bug in which the Binary MIME type of a FileBasedSink could erroneously be changed back to a Text MIME type when using an uncompressed channel.

Protected mutable fields are a terrible design pattern
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 69.825% when pulling 7a99116 on dhalperi:mimetype into 46ca02a on apache:master.

@dhalperi
Copy link
Contributor Author

dhalperi commented May 1, 2017

R: @lukecwik

maybe you'll have thoughts on this one?

Copy link
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Please add comments about mime types and then merge.

@@ -1026,11 +1024,15 @@ public void verifyDeterministic() throws NonDeterministicException {
WritableByteChannel create(WritableByteChannel channel) throws IOException;

/**
* @return the MIME type that should be used for the files that will hold the output data
* Returns the MIME type that should be used for the files that will hold the output data. May
* return {@code null} if this {@code WritableByteChannelFactory} does not meaningful change
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meaningful -> meaningfully

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
protected String mimeType = MimeTypes.TEXT;
private final String mimeType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep a comment that this is the mimetype of the sink and that it can be overridden by the WritableByteChannelFactory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
protected String mimeType = MimeTypes.TEXT;
private final String mimeType;

/**
* Construct a new FileBasedWriter with a base filename.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about the resolution order of mime types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

@dhalperi dhalperi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! All done, will self-merge once green.

*/
protected String mimeType = MimeTypes.TEXT;
private final String mimeType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
protected String mimeType = MimeTypes.TEXT;
private final String mimeType;

/**
* Construct a new FileBasedWriter with a base filename.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1026,11 +1024,15 @@ public void verifyDeterministic() throws NonDeterministicException {
WritableByteChannel create(WritableByteChannel channel) throws IOException;

/**
* @return the MIME type that should be used for the files that will hold the output data
* Returns the MIME type that should be used for the files that will hold the output data. May
* return {@code null} if this {@code WritableByteChannelFactory} does not meaningful change
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@asfgit asfgit closed this in cd813fb May 1, 2017
@dhalperi dhalperi deleted the mimetype branch May 1, 2017 23:40
@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 70.383% when pulling 693d012 on dhalperi:mimetype into 46ca02a on apache:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants