Table of Contents

About

The decorator pattern, also known as a wrapper allows you to extend the run-time behaviour of an object. This process is known as decorating.

A (wrapper|decorator) class is any class which “wraps” or “encapsulates” the functionality of another class or component.

They have several advantages:

  • Protection against the change of code
  • Simplification of code

Interface

A wrapper has generally a wrapper interface that permits to unwrap (to get the wrapped object). Example: javase/9/docs/api/java/sql/Wrapper.html

Documentation / Reference