Skip to content

Commit

Permalink
WIP docs the concepts and design pattern of inspectablewrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jul 2, 2024
1 parent 76b92d0 commit a70a6be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


/**
* This {@code Wrapper} interface is used to be implemented by wrapper classes,
* This {@code Wrapper} interface is used to be implemented by biz wrapper instances,
* make an <strong>inspectable wrapper chain</strong>(linked list).
* <p>
* <strong>Note about wrapper chain:</strong>
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/io/foldright/inspectablewrappers/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@
* <li>The {@link io.foldright.inspectablewrappers.Inspector} class is used to inspect the wrapper chain.
* </ul>
*
* <h2>About wrapper pattern</h2>
*
* <a href="https://refactoring.guru/design-patterns/decorator">Wrapper pattern(aka. Decorator pattern)</a> is
* well-known and widely-used, is used to attach new behaviors to objects
* (the <strong>wrappee</strong>/<strong>underlying instances</strong>/<strong>wrapped instances</strong>)
* by placing these objects inside the <strong>wrapper</strong> objects that contain the behaviors.
* <p>
* Well-known examples of wrapper pattern in java std lib:
* <ul>
* <li>Collection Wrappers:<sup><a href="https://docs.oracle.com/javase/tutorial/collections/implementations/wrapper.html">
* (Wrapper Implementations - The Java™ Tutorials)</a></sup>
* <ul>
* <li>Unmodifiable Wrappers, e.g.
* {@link java.util.Collections#unmodifiableList(java.util.List) Collections#unmodifiableList(List)}
* <li>Synchronization Wrappers, e.g.
* {@link java.util.Collections#synchronizedCollection(java.util.Collection) Collections#synchronizedCollection(Collection)}
* </ul>
* <li>{@link java.io.BufferedReader#BufferedReader(java.io.Reader) BufferedReader#BufferedReader(Reader)}
* </ul>
* <p>
* The related design patterns are <a href="https://refactoring.guru/design-patterns/adapter">Adapter </a>
* the wrapper instances and wra
*
* @author Jerry Lee (oldratlee at gmail dot com)
* @author Zava Xu (zava dot kid at gmail dot com)
* @author Yang Fang (snoop dot fy at gmail dot com)
Expand Down

0 comments on commit a70a6be

Please sign in to comment.