Skip to content

Commit 6d83016

Browse files
authored
Merge branch 'iluwatar:master' into master
2 parents 7e775f3 + 7c8802e commit 6d83016

File tree

460 files changed

+6182
-2941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+6182
-2941
lines changed

Diff for: .all-contributorsrc

+81
Original file line numberDiff line numberDiff line change
@@ -3141,6 +3141,87 @@
31413141
"contributions": [
31423142
"code"
31433143
]
3144+
},
3145+
{
3146+
"login": "romannimets",
3147+
"name": "romannimets",
3148+
"avatar_url": "https://avatars.githubusercontent.com/u/137268574?v=4",
3149+
"profile": "https://github.com/romannimets",
3150+
"contributions": [
3151+
"code"
3152+
]
3153+
},
3154+
{
3155+
"login": "Joel-Dandin",
3156+
"name": "Joel",
3157+
"avatar_url": "https://avatars.githubusercontent.com/u/60149879?v=4",
3158+
"profile": "https://github.com/Joel-Dandin",
3159+
"contributions": [
3160+
"code"
3161+
]
3162+
},
3163+
{
3164+
"login": "244Walyson",
3165+
"name": "Walyson Moises",
3166+
"avatar_url": "https://avatars.githubusercontent.com/u/125759796?v=4",
3167+
"profile": "https://github.com/244Walyson",
3168+
"contributions": [
3169+
"code"
3170+
]
3171+
},
3172+
{
3173+
"login": "Xcyq",
3174+
"name": "Xcyq",
3175+
"avatar_url": "https://avatars.githubusercontent.com/u/39086666?v=4",
3176+
"profile": "https://github.com/Xcyq",
3177+
"contributions": [
3178+
"code"
3179+
]
3180+
},
3181+
{
3182+
"login": "Ritabrata1080",
3183+
"name": "Ritabrata",
3184+
"avatar_url": "https://avatars.githubusercontent.com/u/60834250?v=4",
3185+
"profile": "https://github.com/Ritabrata1080",
3186+
"contributions": [
3187+
"review"
3188+
]
3189+
},
3190+
{
3191+
"login": "trivikr",
3192+
"name": "Trivikram Kamat",
3193+
"avatar_url": "https://avatars.githubusercontent.com/u/16024985?v=4",
3194+
"profile": "https://github.com/trivikr",
3195+
"contributions": [
3196+
"code"
3197+
]
3198+
},
3199+
{
3200+
"login": "vvanghelle",
3201+
"name": "Vincent Vanghelle",
3202+
"avatar_url": "https://avatars.githubusercontent.com/u/3204600?v=4",
3203+
"profile": "https://github.com/vvanghelle",
3204+
"contributions": [
3205+
"translation"
3206+
]
3207+
},
3208+
{
3209+
"login": "antoheri",
3210+
"name": "Antoine Héritier",
3211+
"avatar_url": "https://avatars.githubusercontent.com/u/79988396?v=4",
3212+
"profile": "https://github.com/antoheri",
3213+
"contributions": [
3214+
"translation"
3215+
]
3216+
},
3217+
{
3218+
"login": "fishandsheep",
3219+
"name": "QinShower",
3220+
"avatar_url": "https://avatars.githubusercontent.com/u/43347407?v=4",
3221+
"profile": "https://github.com/fishandsheep",
3222+
"contributions": [
3223+
"translation"
3224+
]
31443225
}
31453226
],
31463227
"contributorsPerLine": 6,

Diff for: .github/workflows/maven-ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ jobs:
4242
steps:
4343

4444
- name: Checkout Code
45-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
4646
with:
4747
# Disabling shallow clone for improving relevancy of SonarQube reporting
4848
fetch-depth: 0
4949

5050
- name: Set up JDK 17
51-
uses: actions/setup-java@v3
51+
uses: actions/setup-java@v4
5252
with:
5353
java-version: '17'
5454
distribution: 'temurin'
5555
cache: 'maven'
5656

5757
- name: Cache local Maven repository
58-
uses: actions/cache@v3
58+
uses: actions/cache@v4
5959
with:
6060
path: ~/.m2/repository
6161
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -64,7 +64,7 @@ jobs:
6464
6565
# Cache Sonar packages which as used to run analysis and collect metrics
6666
- name: Cache SonarCloud packages
67-
uses: actions/cache@v3
67+
uses: actions/cache@v4
6868
with:
6969
path: ~/.sonar/cache
7070
key: ${{ runner.os }}-sonar

Diff for: .github/workflows/maven-pr-builder.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ jobs:
4242
steps:
4343

4444
- name: Checkout Code
45-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
4646
with:
4747
ref: ${{ github.event.pull_request.head.sha }}
4848

4949
- name: Set up JDK 17
50-
uses: actions/setup-java@v3
50+
uses: actions/setup-java@v4
5151
with:
5252
java-version: '17'
5353
distribution: 'temurin'
5454
cache: 'maven'
5555

5656
- name: Cache local Maven repository
57-
uses: actions/cache@v3
57+
uses: actions/cache@v4
5858
with:
5959
path: ~/.m2/repository
6060
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -63,7 +63,7 @@ jobs:
6363
6464
# Cache Sonar packages which as used to run analysis and collect metrics
6565
- name: Cache SonarCloud packages
66-
uses: actions/cache@v3
66+
uses: actions/cache@v4
6767
with:
6868
path: ~/.sonar/cache
6969
key: ${{ runner.os }}-sonar

Diff for: README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
77
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
88
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
9-
[![All Contributors](https://img.shields.io/badge/all_contributors-344-orange.svg?style=flat-square)](#contributors-)
9+
[![All Contributors](https://img.shields.io/badge/all_contributors-353-orange.svg?style=flat-square)](#contributors-)
1010
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1111

1212
<br/>
@@ -519,6 +519,17 @@ This project is licensed under the terms of the MIT license.
519519
<tr>
520520
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Avinash2110"><img src="https://avatars.githubusercontent.com/u/37360069?v=4?s=100" width="100px;" alt="Avinash Shukla"/><br /><sub><b>Avinash Shukla</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Avinash2110" title="Code">💻</a></td>
521521
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Mayankchoudhary294"><img src="https://avatars.githubusercontent.com/u/97609699?v=4?s=100" width="100px;" alt="Mayank Choudhary"/><br /><sub><b>Mayank Choudhary</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Mayankchoudhary294" title="Code">💻</a></td>
522+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/romannimets"><img src="https://avatars.githubusercontent.com/u/137268574?v=4?s=100" width="100px;" alt="romannimets"/><br /><sub><b>romannimets</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=romannimets" title="Code">💻</a></td>
523+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Joel-Dandin"><img src="https://avatars.githubusercontent.com/u/60149879?v=4?s=100" width="100px;" alt="Joel"/><br /><sub><b>Joel</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Joel-Dandin" title="Code">💻</a></td>
524+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/244Walyson"><img src="https://avatars.githubusercontent.com/u/125759796?v=4?s=100" width="100px;" alt="Walyson Moises"/><br /><sub><b>Walyson Moises</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=244Walyson" title="Code">💻</a></td>
525+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Xcyq"><img src="https://avatars.githubusercontent.com/u/39086666?v=4?s=100" width="100px;" alt="Xcyq"/><br /><sub><b>Xcyq</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Xcyq" title="Code">💻</a></td>
526+
</tr>
527+
<tr>
528+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/Ritabrata1080"><img src="https://avatars.githubusercontent.com/u/60834250?v=4?s=100" width="100px;" alt="Ritabrata"/><br /><sub><b>Ritabrata</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3ARitabrata1080" title="Reviewed Pull Requests">👀</a></td>
529+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/trivikr"><img src="https://avatars.githubusercontent.com/u/16024985?v=4?s=100" width="100px;" alt="Trivikram Kamat"/><br /><sub><b>Trivikram Kamat</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=trivikr" title="Code">💻</a></td>
530+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/vvanghelle"><img src="https://avatars.githubusercontent.com/u/3204600?v=4?s=100" width="100px;" alt="Vincent Vanghelle"/><br /><sub><b>Vincent Vanghelle</b></sub></a><br /><a href="#translation-vvanghelle" title="Translation">🌍</a></td>
531+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/antoheri"><img src="https://avatars.githubusercontent.com/u/79988396?v=4?s=100" width="100px;" alt="Antoine Héritier"/><br /><sub><b>Antoine Héritier</b></sub></a><br /><a href="#translation-antoheri" title="Translation">🌍</a></td>
532+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/fishandsheep"><img src="https://avatars.githubusercontent.com/u/43347407?v=4?s=100" width="100px;" alt="QinShower"/><br /><sub><b>QinShower</b></sub></a><br /><a href="#translation-fishandsheep" title="Translation">🌍</a></td>
522533
</tr>
523534
</tbody>
524535
</table>

Diff for: abstract-document/README.md

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
---
2-
title: Abstract Document
2+
title: "Abstract Document Pattern in Java: Simplifying Data Handling with Flexibility"
3+
shortTitle: Abstract Document
4+
description: "Explore the Abstract Document design pattern in Java. Learn its intent, explanation, applicability, benefits, and see real-world examples to implement flexible and dynamic data structures."
35
category: Structural
46
language: en
57
tag:
6-
- Abstraction
7-
- Decoupling
8-
- Dynamic typing
9-
- Encapsulation
10-
- Extensibility
11-
- Polymorphism
8+
- Abstraction
9+
- Decoupling
10+
- Dynamic typing
11+
- Encapsulation
12+
- Extensibility
13+
- Polymorphism
1214
---
1315

14-
## Intent
16+
## Intent of Abstract Document Design Pattern
1517

16-
The Abstract Document design pattern is a structural design pattern that aims to provide a consistent way to handle hierarchical and tree-like data structures by defining a common interface for various document types. It separates the core document structure from specific data formats, enabling dynamic updates and simplified maintenance.
18+
The Abstract Document design pattern in Java is a crucial structural design pattern that provides a consistent way to handle hierarchical and tree-like data structures by defining a common interface for various document types. It separates the core document structure from specific data formats, enabling dynamic updates and simplified maintenance.
1719

18-
## Explanation
20+
## Detailed Explanation of Abstract Document Pattern with Real-World Examples
1921

20-
The Abstract Document pattern enables handling additional, non-static properties. This pattern uses concept of traits to enable type safety and separate properties of different classes into set of interfaces.
22+
The Abstract Document design pattern in Java allows dynamic handling of non-static properties. This pattern uses concept of traits to enable type safety and separate properties of different classes into set of interfaces.
2123

2224
Real-world example
2325

24-
> Imagine a library system where books can have different formats and attributes: physical books, eBooks, and audiobooks. Each format has unique properties, such as page count for physical books, file size for eBooks, and duration for audiobooks. The Abstract Document design pattern allows the library system to manage these diverse formats flexibly. By using this pattern, the system can store and retrieve properties dynamically, without needing a rigid structure for each book type, making it easier to add new formats or attributes in the future without significant changes to the codebase.
26+
> Consider a library system implementing the Abstract Document design pattern in Java, where books can have diverse formats and attributes: physical books, eBooks, and audiobooks. Each format has unique properties, such as page count for physical books, file size for eBooks, and duration for audiobooks. The Abstract Document design pattern allows the library system to manage these diverse formats flexibly. By using this pattern, the system can store and retrieve properties dynamically, without needing a rigid structure for each book type, making it easier to add new formats or attributes in the future without significant changes to the codebase.
2527
2628
In plain words
2729

@@ -31,7 +33,7 @@ Wikipedia says
3133

3234
> An object-oriented structural design pattern for organizing objects in loosely typed key-value stores and exposing the data using typed views. The purpose of the pattern is to achieve a high degree of flexibility between components in a strongly typed language where new properties can be added to the object-tree on the fly, without losing the support of type-safety. The pattern makes use of traits to separate different properties of a class into different interfaces.
3335
34-
**Programmatic Example**
36+
## Programmatic Example of Abstract Document Pattern in Java
3537

3638
Consider a car that consists of multiple parts. However, we don't know if the specific car really has all the parts, or just some of them. Our cars are dynamic and extremely flexible.
3739

@@ -177,13 +179,13 @@ The program output:
177179
07:21:57.395 [main] INFO com.iluwatar.abstractdocument.App -- door/Lambo/300
178180
```
179181
180-
## Class diagram
182+
## Abstract Document Pattern Class Diagram
181183
182184
![Abstract Document](./etc/abstract-document.png "Abstract Document Traits and Domain")
183185
184-
## Applicability
186+
## When to Use the Abstract Document Pattern in Java
185187
186-
This pattern is particularly useful in scenarios where you have different types of documents that share some common attributes or behaviors, but also have unique attributes or behaviors specific to their individual types. Here are some scenarios where the Abstract Document design pattern can be applicable:
188+
The Abstract Document design pattern is especially beneficial in scenarios requiring management of different document types in Java that share some common attributes or behaviors, but also have unique attributes or behaviors specific to their individual types. Here are some scenarios where the Abstract Document design pattern can be applicable:
187189
188190
* Content Management Systems (CMS): In a CMS, you might have various types of content such as articles, images, videos, etc. Each type of content could have shared attributes like creation date, author, and tags, while also having specific attributes like image dimensions for images or video duration for videos.
189191
@@ -209,7 +211,7 @@ This pattern is particularly useful in scenarios where you have different types
209211

210212
The key idea behind the Abstract Document design pattern is to provide a flexible and extensible way to manage different types of documents or entities with shared and distinct attributes. By defining a common interface and implementing it across various document types, you can achieve a more organized and consistent approach to handling complex data structures.
211213

212-
## Consequences
214+
## Benefits and Trade-offs of Abstract Document Pattern
213215

214216
Benefits:
215217

@@ -227,7 +229,7 @@ Trade-offs:
227229

228230
* Performance: Might introduce slight performance overhead compared to direct data access.
229231

230-
## Credits
232+
## References and Credits
231233

232234
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)
233235
* [Java Design Patterns: A Hands-On Experience with Real-World Examples](https://amzn.to/3yhh525)

0 commit comments

Comments
 (0)