[JAVA] If you want to include the parent class in Lombok's @builder

Copy the code from https://stackoverflow.com/questions/44948858/lombok-builder-on-a-class-that-extends-another-class. `` `@ Builder``` is often attached to the class, but there is a workaround to give it to the constructor and enumerate both parent and child parameters there.

public class Parent {
	  private double d;
	  private float e;
public class Child extends Parent  {
	  private String a;
	  private int b;
	  private boolean c;

	  public Child(String a, int b, boolean c, double d, float e) {
	    super(d, e);
	    this.a = a;
	    this.b = b;
	    this.c = c;
Child child = Child.builder().a("aVal").b(1000).c(true).d(10.1).e(20.0F).build();
Child(super=Parent(d=10.1, e=20.0), a=aVal, b=1000, c=true)

Recommended Posts

If you want to include the parent class in Lombok's @builder
If you want to recreate the instance in cloud9
If you want to satisfy the test coverage of private methods in JUnit
[PostgreSQL] If you want to delete the Rails app, delete the database first!
If you want to change the Java development environment from Eclipse
What to do if you forget the root password in CentOS7
[Swift] When you want to know if the number of characters in a String matches a certain number ...
If you just want to run your containers in the cloud, Azure Container Instances is easy
If you want to mock a method in RSpec, you should use the allow method for mock and the singleton method.
If you want to dynamically embed values & add text to attribute values in Thymeleaf 3
If you want to modify database columns etc.
When you get lost in the class name
When you want to bind InputStream in JDBI3
When you want to use the method outside
I want to get the value in Ruby
If the parameter is an array, how to include it in Stopara's params.permit
If you are using Android Room and want to change the column definition
In Bean Validation, if you want to include Field Name in Error Message, it cannot be output from LocalValidatorFactoryBean.
If you want to know the options when configuring Ruby, see `RbConfig :: CONFIG ["configure_args "]`
I want to embed any TraceId in the log
What to do if you can't get the text of an element in Selenium
If you want to separate Spring Boot + Thymeleaf processing
If you want to use Mockito with Kotlin, use mockito-kotlin
When you want to dynamically replace Annotation in Java8
What to do if you cannot execute with the command "Java package name / class name"
If hash [: a] [: b] [: c] = 0 in Ruby, I want you to extend it recursively even if the key does not exist.
How to write in Model class when you want to save binary data in DB with PlayFramework
What to do if you don't see the test code error message in the terminal console
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
Use JLine when you want to handle keystrokes on the console character by character in Java
Memo that transitions to the login screen if you are not logged in with devise
When you want to reflect the Master Branch information in the Current Branch you are currently working on
Solution if you delete the migration file in the up state
How to get the class name / method name running in Java
What to do if you get a java.io.IOException in GlassFish
I want to set the conditions to be displayed in collection_check_boxes
If you want to study programming at university, go to Australia
[# 3 Java] Read this if you want to study Java! ~ Carefully selected ~
I want to give a class name to the select attribute
I want to recursively search the class list under the package
When you want to change the MySQL password of docker-compose
I want to transition to the same screen in the saved state
What to do if you can't use the rails command
I want to simplify the conditional if-else statement in Java
[For super beginners] The minimum knowledge you want to keep in mind with hashes and symbols
What to do when you want to know the source position where the method is defined in binding.pry
[Words spelled to me when I was in the first grade ⑦] What I want you to include at least with the Visual Studio Code extension
[Rails / Routing] How to refer to the controller in the directory you created
What to do if you get a gcc error in Docker
ProxyFactory is convenient when you want to test AOP in Spring!
When you want to ZIP download the image data saved locally
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if Cloud9 is full in the Rails tutorial
What to do if you get a DISPLAY error in gym.render ()
I want to display the images under assets/images in the production environment
I want to remove the top margin in Grouped UITableView (swift)
Determine if the strings to be compared are the same in Java
[Java] I want to perform distinct with the key in the object
I want to change the value of Attribute in Selenium of Ruby
[Android] I want to get the listener from the button in ListView
What to do if you cannot roll back the migration (UnknownMigrationVersionError)