GeezerVison is showing github.com — Provide a .buildStorageService() method on the StorageServiceOptions class? · Issue #54 · googleapis/google-cloud-java
Provide a .buildStorageService() method on the StorageServiceOptions class? #54DescriptionRight now, to create a StorageService object, I need to do:
StorageServiceOptions options = StorageServiceOptions.builder()
.projectId("project")
.build();
StorageService storage = StorageServiceFactory.instance().get(options);
Would it be worthwhile to do this as
StorageService storage = StorageServiceOptions.builder()
.projectId("project")
.build().buildStorageService();
Or maybe we can have a StorageServiceBuilder?
StorageService storage = StorageService.builder()
.projectId("project")
.build();Activityadded this to the This milestone has been deleted milestone on May 12, 2015jboynes commented on May 12, 2015 It would nice if this worked with the standard injection mechanisms like @resource so that applications did not have to be concerned with all the configuration. For example:
@Resource StorageService storageService;
I think most applications typically interact only with a single bucket in which case injecting a reference to the bucket would be simpler. see #55 modified the milestones: This milestone has been deleted, This milestone has been deleted on Jun 1, 2015aozarov commented on Jun 1, 2015 @jgeewax , I don't think this belongs in this milestone as as I think the answer for this API questions would benefit from a wider set of opinions. jgeewax commented on Jun 2, 2015 @aozarov : Not sure what you're saying. It seems to me like this would be a really nice way to get a StorageService object. If we're all focused on usability, this seems like something to push out before making a bunch of broadcasts about the library being ready for others to dig into...
Can you give any more background on why this wouldn't make the cut in your opinion ? aozarov commented on Jun 2, 2015 I am saying that if the milestone "Needed for public announcement" is the things we must do before announcement I think this does not qualify (as it is more style issue) and I think I would like to get more feedback before doing it. I expect such feedback to come after we announce and this project gets more visibility. jgeewax commented on Jun 2, 2015 I think this is a basic usability thing, that I'd consider table stakes for "a super usable Java library". Seems weird that we'd wait for people to complain rather than just adding the shortcut method. Do you think that the suggestion is "clearly more convenient" or "no difference" or "clearly less convenient"? aozarov commented on Jun 2, 2015 I think current style is idiomatic and common. it is indeed slightly longer (though could still be a one liner).
e.g.
Storage storage = StorageFactory.instance().get(StorageOptions.defaultInstance());
Having several ways to do the same thing is not necessarily better and I would like to get more opinions about it.
Also, current way makes it easy to provide/inject different factory implementations. mziccard commented on Oct 27, 2015
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|