RUVIDEO
Поделитесь видео 🙏

Builder Design Pattern In Java | Create your own builder class by Creational Builder pattern смотреть онлайн

#Builder #Design #Pattern #GOF
Builder Design Pattern in Java - Step by Step Guide ► SUBSCRIBE & LIKE!!

► Official Email Id: [email protected]
► Download the Code GitHub: https://github.com/admindebu
► Follow on Facebook: https://www.facebook.com/TechTalkDebu
► Follow on LinkedIn: https://www.linkedin.com/in/debu-paul

~~~~~~~~
► Here is our amazing playlist for Core Java, Spring MVC/Boot, Git and Microservice
~~~~~
1. Micro Service :: https://www.youtube.com/watch?v=pscyaLdGtnI&list=PLRlT3yKdok6r_6j4Y0R75TP4WiiaT21K7
~~~~~~~~~~~~
CodeBase & Info
~~~~~~~~~~~~
1. Builder Design pattern is - Based on Creational Structural pattern

2. Why Builder Design Pattern introduce - Builder pattern was introduced to solve some of the problems with Factory and Abstract Factory design patterns when the Object contains a lot of attributes.

3. Few Example of JDK Library class which is created based on Builder pattern - StringBuffer, StringBuilder, etc

4. Builder pattern solves the issue with large number of optional parameters and inconsistent state by providing a way to build the object step-by-step and provide a method that will actually return the final Object.

5. Step to Create your Custom Builder Design Pattern :
- First of all you need to create a static nested class and then copy all the arguments from the outer class to the Builder class.
- We should follow the naming convention and if the class name is Computer then builder class should be named as ComputerBuilder.
- Java Builder class should have a public constructor with all the required attributes as parameters.
Java Builder class should have methods to set the optional parameters and it should return the same Builder object after setting the optional attribute.
- The final step is to provide a build() method in the builder class that will return the Object needed by client program. For this we need to have a private constructor in the Class with Builder class as argument.

Example : XML Builder Utility
Class Name : Element.java
public class Element {
private String name;
private String value;
private Boolean isEndTag;
private Boolean isParent;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Boolean getIsParent() {
return isParent;
}
public void setIsParent(Boolean isParent) {
this.isParent = isParent;
}
public Boolean getIsEndTag() {
return isEndTag;
}
public void setIsEndTag(Boolean isEndTag) {
this.isEndTag = isEndTag;
}
}
Class Name: RootElement.java
public class RootElement {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}}

Class Name: XMLBuilder.java
public class XMLBuilder {
protected static StringBuffer sb = new StringBuffer();
private RootElement rootElement;
private Element element;
public Element getElement() {
return element;
}
public RootElement getRootElement() {
return rootElement;
}
public void setRootElement(RootElement rootElement) {
this.rootElement = rootElement;
}
public void setElement(Element element) {
this.element = element;
}
private XMLBuilder(Builder builder) {
this.element=builder.element;
this.rootElement=builder.rootElement;
}
// Static Builder class
public static class Builder {
private RootElement rootElement = new RootElement();
private Element element = new Element();

public Builder(String rootElementName) {
if (rootElementName == null) {
throw new IllegalArgumentException("RootElement and element can not be null");
}else{
this.rootElement.setName("(" +rootElementName + ")");
}
sb.append(this.rootElement.getName());
}
public Builder addEndRootTag(String name) {
this.rootElement.setName("(/" + name + ")");
sb.append(rootElement.getName());
return this;
}
public Builder addStartTag(String name, Boolean isParent) {
this.element.setName("(" + name + ")");
this.element.setIsParent(isParent);
sb.append(element.getName());
return this;
}
public Builder addValue(String value) {
this.element.setValue(value);
sb.append(element.getValue());
return this;
}
public Builder addEndTag(String name) {
this.element.setName("(/" + name + ")");
sb.append(element.getName());
return this;
}
public XMLBuilder build() {
return new XMLBuilder(this);
}}

public String getXML(XMLBuilder xmlBuilder) {
String result = xmlBuilder.sb.toString();
return result;
}
}


Class Name: SampleXMLCreate.java
public class SampleXMLCreate {
public static void main(String[] args) {
XMLBuilder xmlBuilder = new Builder("Root")
.addStartTag("Parent", true)
.addValue("Value 2")
.addEndTag("Parent")
.addEndRootTag("Root")
.build();
System.out.println(xmlBuilder.getXML(xmlBuilder));
}
}

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Builder Design Pattern In Java | Create your own builder class by Creational Builder pattern» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.