Method name of method chain in Java Builder + α

In Java Builder pattern

When implementing the process to generate the Client class using the Builder pattern I'm a group that specifies the parameter name as it is, such as "header" or "body" for the method name that sets the parameter. It would be nice to have a verb such as set or add as a prefix, which is more Java-like and easier to understand. There was a story. (It is difficult to understand whether it will be overwritten or added if it is only header = the result is difficult to understand)

In the frameworks and libraries I have used, there are many images with only parameter names, but Speaking of Java-likeness, it certainly feels better to have a prefix as a verb. (Easy to understand) Even in the explanation of the Builder pattern on the net, there are many parameter names only, so I think that only the parameter names are standard (personally), but which is more common? ..

+α In connection with the above, I also talked about the likes and dislikes of method chains. I'm a method chain lover, so I want to use it a lot in implementation. However, I received the opinion that "If it is written all in one line, it takes time and effort to erase only the place you want to erase, so it is not good." It is a matter of likes and dislikes, but there are many people who are not good at it. I received the recognition that it was. (I like it because I can describe it concisely.)


It was mentioned as a topic in the story, so I tried to write it somehow.

Which party are you? I love parameter names only + method chains.

Recommended Posts

Method name of method chain in Java Builder + α
[Java] Handling of JavaBeans in the method chain
[Java] Handling of JavaBeans in the method chain
Method name of method chain in Java Builder + α
RxSwift method chain
Method name of static factory method learned from Java 8
Benefits of Java static method
Implementation of tri-tree in Java
How to get the class name / method name running in Java
Automatic photo resizing method in Java
List of members added in Java 9
How to name variables in Java
List of types added in Java 9
Implementation of like function in Java
Call the super method in Java
[Java] Returns a Japanese name file in filename of HTTP header
Implementation of clone method for Java Record
[Java] I participated in ABC-188 of Atcorder.
Implementation of DBlayer in Java (RDB, MySQL)
Get the result of POST in Java
Name a group of regular expressions (Java)
Java method
java (method)
Call Java method from JavaScript executed in Java
Concurrency Method in Java with basic example
What is the main method in Java?
Java method
Comparison of thread implementation methods in Java and lambda expression description method
[Java] method
The story of writing Java in Emacs
Element operation method in appium TIPS (Java)
Role of JSP in Web application [Java]
Discrimination of Enums in Java 7 and above
[Java] method
Call a method of the parent class by explicitly specifying the name in Ruby
[Java] Is it unnecessary to check "identity" in the implementation of the equals () method?
Cause of is not visible when calling a method of another class in java
[Order method] Set the order of data in Rails
The story of low-level string comparison in Java
The story of making ordinary Othello in Java
[Java] Dynamic method call by reflection of enum (enum)
The order of Java method modifiers is fixed
The story of learning Java in the first programming
Deserialize CSV in Java based on header name
Measure the size of a folder in Java
[Java] Use of final in local variable declaration
Feel the passage of time even in Java
A quick review of Java learned in class
Enumerate subsets of arrays given in Ruby (+ α)
[JAVA] [Spring] [MyBatis] Use IN () with SQL Builder
Import files of the same hierarchy in Java
Why use setters/getters instead of public/private in Java
[Java] Get KFunction from Method / Constructor in Java [Kotlin]
Provisional memo when the name of the method parameter of the Java class cannot be obtained by reflection in the Eclipse plug-in project.
Partization in Java
[Java] Integer information of characters in a text file acquired by the read () method
Changes in Java 11
RxSwift method chain
[Java] Implementation method memo to set WS-Security Username Token in SOAP Stub of axis2
Java8 method reference
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
Rock-paper-scissors in Java
[Java] forEach method