Java | Builder Design Pattern

Java POJO classes can be created using different design patterns. Below is example how Builder pattern works.

Normally, Simple java POJO class setter-call has void return type. Builder pattern replace void return type and returns current object of class(ie. return this). Builder pattern can be used to replace parameterised constructor. Also when we create object the code is more readable.

Example :



Comments

Popular posts from this blog

Spring | Using TIBCO EMS with Spring framework

TIBCO | For Loop - Accumulate output

TIBCO | JNDI Server & JMS Instance creation