What is the design pattern that Wrapper Classes use in Java?

  • A+

I have found an old post on stackoverlflow which does not clarify my understanding about the design pattern that are being used by Wrapper Classes.

What is a wrapper class? -- Link belongs to older post.

Does Wrapper Classes really use any design pattern or not ?

If it is using any pattern then pattern it is out of these Decorator Pattern, Facade Pattern or Adapter Pattern.

More over on reading from Wikipedia I am not getting any clear information.

If answer to my question is already available on some post then please provide the link so I can have a look.


Adapter pattern is the most exact meaning:

A decorator makes it possible to add or alter behavior of an interface at run-time. Alternatively, the adapter can be used when the wrapper must respect a particular interface and must support polymorphic behavior, and the Facade when an easier or simpler interface to an underlying object is desired

We use Wrapper class ability to use primitive as Objects, meaning add support to a polymorphic behavior


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: