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.

Provide fluent nested builders for model objects.

See original GitHub issue

Currently, the generated model has a builder-like structure baked inside the model objects. Given the depth of the model, it would really help if the builders supported more advanced features like nesting, visitors and in-lining (similar to what we have in the https://github.com/fabric8io/kubernetes-client).

nesting makes it so much easier to create model objects directly in java. It’s faster to write, it’s more IDE friendly etc.

visitors allow making changes, without having to explicitly traverse the object tree. (e.g. allows doing things like visit all Pod Specs in the tree and add a sidecar container without having to care if the spec is under a Deployment, DeploymentConfig, Pod, ReplicaSet etc).

in-lining allows to use the builder structure but instead of building the object directly to pass the object to a function. This allows to seamlessly integrate the builder into the client dsl.

Now, if we could get those builders either as part of the kubernetes module, it would open up the room of aligning with the https://github.com/fabric8io/kubernetes-client.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
iocanelcommented, Feb 16, 2018

On 02.16.18, Paulo Pires wrote:

@iocanel did you make any progress?

Yeah, I do have something working. Will create a pull request shortly.

– You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/kubernetes-client/java/issues/137#issuecomment-366261954

2reactions
iocanelcommented, Dec 15, 2017

@brendanburns: I’ve written a generator myself that we used for the fabric8 kubernetes-client. So let’me try to integrate it and see how it goes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested Fluent Builders with Java 8 - The Agile Jedi
Builder we want to make sure that the object reference is stored in the Invoice attribute invoiceSupplier. To allow this to happen we...
Read more >
Fluent Builder Pattern — C#. It's very common to ... - Medium
Each field has multiple fields and some of them could have nested objects. Good luck to create a new instance of this manually....
Read more >
Builder pattern with nested objects - Stack Overflow
I want to implement the builder pattern to make creating my objects easier. The problem I face has to do with nested object....
Read more >
4 Ways to Implement Builder Design Pattern in C#
Fluent builder is a variation of Builder design pattern where every method except Build returns this pointer. Here's how Fluent Builder is used:...
Read more >
Fluent Builder Interface With Recursive Generics - Code Maze
The Problem With the Fluent Builder Inheritance ... But, as we can see, we are not able to create a required object. This...
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