googlegenomics / utils-java

Common Java files for Google Genomics integrations.
Apache License 2.0
5 stars 11 forks source link

Expose field mask interceptor utility #99

Open calbach opened 8 years ago

calbach commented 8 years ago

I wound up using stub.withInterceptors() in a project to avoid opening a new channel every time I wanted different field masks; I wound up copy-pasting from https://github.com/googlegenomics/utils-java/blob/master/src/main/java/com/google/cloud/genomics/utils/grpc/GenomicsChannel.java#L75. Would be nice to expose the field mask interceptor logic via a public utility as I believe the current library only allows setting up a field mask while also creating a new channel.

pgrosu commented 8 years ago

That's a really good idea, and would definitely save some time! Currently a ManagedChannel is generated with empty fields, upon which a stub gets added afterwards for each type of request service containing the appropriate fields built up via interceptors through a Metadata type.

Separating the logic of setting the fields via a returned Metadata object, and then feeding that to an updateStub method that would overwrite the current stub would make the current implementation a bit easier to read and probably manage as well :)

Thanks, ~p