Browse Java Design Patterns & Enterprise Application Architecture

Extension Objects vs. Decorators

Compare Extension Object and Decorator in Java so optional capabilities and wrapper-based behavior layering are not confused.

On this page

Extension Object and Decorator both deal with optional functionality, but they do it differently.

Decorator

Decorator wraps an object and preserves the same contract while adding behavior around it.

Extension Object

Extension Object exposes additional capabilities through separate types that may or may not be present.

Java Shortcut

Ask:

  • “Should every caller still see the same contract, just with extra behavior?” -> Decorator
  • “Should some callers discover optional capabilities that not all instances support?” -> Extension Object

That difference matters.

Revised on Thursday, April 23, 2026