Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jun 10, 2024
1 parent 08ae76a commit fe12b77
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/java/io/foldright/inspectablewrappers/Wrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@


/**
* 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>
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* This {@code WrapperAdapter} interface is used to
* adapt an existed wrapper instance to type {@link Wrapper} without modifying it.
* adapt an existed wrapper instance with type {@link Wrapper} without modifying it.
* <p>
* The existed wrapper may not be able to be modified to integrate with {@code inspectable wrappers};
* Integration with {@code inspectable wrappers} means implementation the {@link Wrapper} interface.
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 fe12b77

Please sign in to comment.