bridge patter

This commit is contained in:
Volodymyr Karpenko 2022-10-26 16:08:56 +02:00
parent fddbf895ca
commit 5f4cd01b32

View file

@ -496,7 +496,7 @@ format.
enclosed fields are simply used in a composition relationship.
\end{description}
\subsection{TBD Decorator Pattern}
\subsection{Decorator Pattern}
Decorator pattern lets you dynamically change the behaviour of an object at run
time by wrapping them in an object of a decorator class.
\textit{Pattern4J} found two instances of the decorator patter,
@ -556,8 +556,18 @@ so thats why we have a misclassification signalling the decorator pattern and no
it is used in \textbf{writeObject, writeTree, copyCurrentEvent, copyCurrentStructure} methods to signal if delegate the function call to the delegator or to the super class.
\end{description}
\subsection{TBD Bridge Pattern}
TBD
\subsection{Bridge Pattern}
\textit{Pattern4J} found one instance of the bridge pattern.
The bridge pattern emphasises composition rather than inheritance.
Implementation details are moved from one hierarchy to another with separate hierarchies of objects.
Looking on the context of the library that is intended to be used as a core for a JSON parser
and by looking at the class implemented it make even more sense.
The class detected is \textbf{json.JsonGeneratorImpl} and the class used is \textbf{io.CharacterEscapes}.
The \textbf{io.CharacterEscapes} class define the escape character used in the file
and is particularly relevant to have this abstraction because there are different standards for string escaping on different systems.
For example on unix systems the escape sequence is ``\textbackslash n'',
where on Microsoft operating systems the escape sequence is ``\textbackslash r\textbackslash n''
and on IBM mainframe systems the escape sequence is ``\textbackslash 025''.
\section{Behavioral Patterns}