{"id":19575628,"url":"https://github.com/husna-poyraz/builder_design_pattern","last_synced_at":"2025-02-26T11:26:53.618Z","repository":{"id":137278646,"uuid":"603736971","full_name":"Husna-POYRAZ/builder_design_pattern","owner":"Husna-POYRAZ","description":"Builder design pattern and builder annotation","archived":false,"fork":false,"pushed_at":"2023-02-19T13:05:16.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T04:21:53.835Z","etag":null,"topics":["annatation","builder-design-pattern","contruction","java","lombok"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Husna-POYRAZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-19T12:37:03.000Z","updated_at":"2023-02-19T12:41:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e52df7d-8d71-4ec1-a4dc-4d7a3f3325d3","html_url":"https://github.com/Husna-POYRAZ/builder_design_pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Husna-POYRAZ%2Fbuilder_design_pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Husna-POYRAZ%2Fbuilder_design_pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Husna-POYRAZ%2Fbuilder_design_pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Husna-POYRAZ%2Fbuilder_design_pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Husna-POYRAZ","download_url":"https://codeload.github.com/Husna-POYRAZ/builder_design_pattern/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240842454,"owners_count":19866581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annatation","builder-design-pattern","contruction","java","lombok"],"created_at":"2024-11-11T06:48:57.725Z","updated_at":"2025-02-26T11:26:53.591Z","avatar_url":"https://github.com/Husna-POYRAZ.png","language":"Java","readme":"# Builder Design Pattern\nSuppose there is more than one field belonging to an object in object-oriented programming. \n```\n@Data\n@AllArgsConstructor\npublic class Country {\n    private String id;\n    private String name;\n    private String nativeName;\n    private int phoneCode;\n    private String continent;\n    private String capital;\n    private String currency;\n    private List\u003cString\u003e languages;\n}    \n```\n\nWhen creating the object, we pass the objects that we do not want to give a value as null.\n```\n\nCountry country1 = new Country(\"TR\", \"Turkey\", null, 0, null, null, null, null);\n\n```\n\nAs the number of parameters increases, the readability will decrease. The probability of error will increase. With the Builder design pattern, if you want to set a field to null, you don't need to do anything. We can also use it like this by adding the @Builder annotation.\n\n```\n@Data\n@AllArgsConstructor\n@Builder\npublic class Country {\n    private String id;\n    private String name;\n    private String nativeName;\n    private int phoneCode;\n    private String continent;\n    private String capital;\n    private String currency;\n    private List\u003cString\u003e languages;\n} \n```\n\n```\nCountry country = Country.builder()\n        .id(\"TR\")\n        .name(\"Turkey\")\n        .build();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhusna-poyraz%2Fbuilder_design_pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhusna-poyraz%2Fbuilder_design_pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhusna-poyraz%2Fbuilder_design_pattern/lists"}