builder-pattern Questions

6

Solved

What tools or libraries exists for Java that will take an interface only with accessor method definitions and automatically generate an immutable object class and also a "builder" class for increme...
Monitory asked 6/2, 2013 at 9:43

7

Solved

In Java, you can use the builder pattern to provide a more readable means to instantiating a class with many parameters. In the builder pattern, one constructs a configuration object with methods t...
Andre asked 15/8, 2012 at 21:5

12

Solved

I have recently started to read Effective Java by Joshua Bloch. I found the idea of the Builder pattern [Item 2 in the book] really interesting. I tried to implement it in my project but there were...
Subdelirium asked 15/2, 2011 at 17:48

12

Solved

Is there any way to automate writing Builder patterns in IntelliJ? For example, given this simple class: class Film { private String title; private int length; public void setTitle(String tit...

27

Solved

What is the difference between the Builder design pattern and the Factory design pattern? Which one is more advantageous and why ? How do I represent my findings as a graph if I want to t...

3

Solved

I am using Lombok for my project. My model looks like: @Builder @Data @AllArgsConstructor public class ScreenDefinitionDTO { @Singular private List<ScreenDeclaration> screens; } I want t...
Ingenue asked 30/11, 2017 at 12:24

5

If for example I have a builder set up so I can create objects like so: Node node = NodeBuilder() .withName(someName) .withDescription(someDesc) .withData(someData) .build(); How can I make ...
Flyleaf asked 20/5, 2016 at 10:16

7

Solved

EDIT: I am not worried about being called in the wrong order since this is enforced through using multiple interfaces, I am just worried about the terminal method getting called at all. I am usi...
Hydrograph asked 7/7, 2011 at 15:52

1

Solved

In fact, I would like to ask if my approach is correct, as maybe I should not use builder pattern right here. I currently have the following class CsvItem: public class CsvItem { private CsvItem...
Don asked 4/6, 2018 at 15:51

9

Solved

The builder pattern is popular to create immutable objects, but there is some programming overhead to create a builder. So I wonder why not simply using a config object. The usage of a builder wou...
Farsighted asked 3/8, 2010 at 8:30

4

I have a Kotlin data class that I am constructing with many immutable properties, which are being fetched from separate SQL queries. If I want to construct the data class using the builder pattern,...
Chaim asked 6/8, 2017 at 18:36

0

I am trying to use lombok's @Builder with inheritance and Jackson. I was building things from https://reinhard.codes/2015/09/16/lomboks-builder-annotation-and-inheritance/, https://gist.github.com...
Riyal asked 14/6, 2017 at 19:28

2

Based on the following examples, its possible to write a build-pattern with chained method calls in Rust which either passes by value or by reference (with a lifetime specifier) Is it possible to...
Aceldama asked 12/1, 2017 at 15:37

1

Solved

I have a builder class which I am using in one of my project. Let's say I have metricA as builder based on below class. I need to make a new builder metricB based on metricA by cloning metricA so...
Orphrey asked 18/12, 2016 at 7:20

3

Solved

Definition of Builder Pattern: The Builder pattern separates the specification of a complex object from its actual construction. The same construction process can create different representations. ...
Instantly asked 29/10, 2016 at 11:17

4

Solved

Foo foo = Foo.builder() .setColor(red) .setName("Fred") .setSize(42) .build(); So I know there is the following "Builder" solution for creating named parameters when calling a method. Althoug...
Legalize asked 26/9, 2016 at 17:18

1

Solved

when using a Builder Pattern why shouldn't I reuse the builder-object to access the object configuration? For example: Normal way: ObjectA(ObjectBuilder b) { this.a = b.getA(); } public Object g...
Dashed asked 7/9, 2016 at 15:12

4

Solved

Suppose I need some DerivedBuilder to extend some BaseBuilder. Base builder has some method like foo (which returns BaseBuilder). Derived builder has method bar. Method bar should be invoked after ...
Macadam asked 18/8, 2016 at 10:14

1

Solved

Hi I'm stuck with a problem. I want to implement the builder pattern to make creating my objects easier. The problem I face has to do with nested object. The object I would like to create has a li...

4

I have a factory method which returns implementation of an interface. The thing is - implementations have different constructor parameters. My question is - how to pass parameters through factory ...
Arliearliene asked 11/1, 2016 at 16:26

1

Solved

This might be a pretty subjetive question, but i would to know some more opinions. I've built a Rest API service with Spring MVC, and i implemented the DTO-Domain-Entity pattern. I want to know wha...

10

Solved

Motivation Recently I searched for a way to initialize a complex object without passing a lot of parameter to the constructor. I tried it with the builder pattern, but I don't like the fact, that ...
Meathead asked 28/10, 2009 at 17:14

4

Solved

Is there a standard practice in Java, while using the builder pattern, to ensure that a member variable is set at most once. I need to make sure that the setter is called 0 or 1 times but never mor...
Logarithmic asked 26/8, 2014 at 3:48

2

Solved

I am trying to use Builder Pattern for my class.. Below is my Builder class which I have built by following Joshua Bloch version as he showed in Effective Java, 2nd Edition. Our customer will mos...
Lynseylynus asked 10/1, 2014 at 20:44

2

Solved

I have recently learned Joshua Bloch's builder pattern for creating objects with many optional fields. I've been using something like it for years, but never used an inner-class until Bloch's book ...
Katiekatina asked 5/1, 2014 at 19:12

© 2022 - 2024 — McMap. All rights reserved.