question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider making JibContainerBuilder interface more fluent.

See original GitHub issue

Continuing from #881

Considering that we are modeling JibContainerBuilder’s interface off of the Stream API, and that JibContainerBuilder begins with Jib.from, we should probably make the rest of the API more fluent as well.

addLayer(List<Path>, String) -> layer(List<Path>, String) addLayer(LayerConfiguration) -> layer(LayerConfiguration) setLayers(List<LayerConfiguration>) -> layer(List<LayerConfiguration>) setEntrypoint(List<String>/String...) -> entrypoint(List<String>/String...) setProgramArguments(List<String>/String...) -> programArguments(List<String>/String...) setEnvironment(Map<String, String>) -> environment(Map<String, String>) setEnvironmentVariable(String, String) -> environmentVariable(String, String) setExposedPorts(List<Port>/Port...) -> expose(List<Port>/Port...) addExposedPort(Port) -> expose(Port) setLabels(Map<String, String>) -> label(Map<String, String>) addLabel(String, String) -> label(String, String)

Also, currently, the collection setters (like setExposedPorts) replace previously-set ports. If converting to use this more fluent API, these collection setters should append, not replace. We could add methods like exposeOnly(Map) that behaves like the original setters.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
briandealwiscommented, Sep 7, 2018

We could provide exposeOnly(Map<>) variants that take a Map?

0reactions
coollogcommented, Feb 12, 2019

Closing and sticking with current design since it is clearer in the functions’ intentions, especially for methods like addExposedPort vs setExposedPort (expose vs exposeOnly is less clear and still involves extra Only portion).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Start implementing Jib and JibContainerBuilder. #881 - GitHub
Jib API: JibContainerBuilder from(String imageReference) JibContainerBuilder ... Consider making JibContainerBuilder interface more fluent.
Read more >
How Fluent Interfaces Can Lead to More Meaningful Code
A fluent interface is designed to mimic a Domain-Specific-Language (DSL) by relying heavily on method-chaining. In object-oriented programming, ...
Read more >
FluentInterface - Martin Fowler
The more the use of the API has that language like flow, the more fluent it is. Building a fluent API like this...
Read more >
java - What is the difference between a fluent interface and the ...
Fluent Interfaces are semantic facades. You put them on top of existing code to reduce syntactical noise and to more clearly express what ......
Read more >
Fluent Interfaces are Evil - Ocramius' blog
I think a builder is the perfect example to this. Marco Pivetta • 9 years ago. Right, didn't actually consider the fluent interface...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found