Files
java-design-patterns/role-object/README.md
T
Ilkka Seppälä 4108f86177 docs: Prepare for new website launch (#2149)
* Changed database implementation. Removed static objects.

* Fix Logs

* Fix 40 errors from checkstyle plugin run. 139 left))

* Fix CacheStore errors from checkstyle plugin 107 left

* Fix last errors in checkstyle.

* Fix sonar issues

* Fix issues in VALIDATE phase

* Fix Bug with mongo connection. Used "Try with resources"

* Add test

* Added docker-compose for mongo db. MongoDb db work fixed.

* Provided missing tests

* Comments to start Application with mongo.

* Fix some broken links

* Remove extra space

* Update filename

* Fix some links in localization folders

* Fix link

* Update frontmatters

* Work on patterns index page

* Work on index page

* Fixes according PR comments. Mainly Readme edits.

* fix frontmatter

* add missing png

* Update pattern index.md

* Add index.md for Chinese translation

* update image paths

* update circuit breaker image paths

* Update image paths for localizations

* add generated puml

* Add missing image

* Update img file extensions

* Update the rest of the EN and ZH patterns to conform with the new website

Co-authored-by: Victor Zalevskii <zvictormail@gmail.com>
2022-10-23 16:29:49 +03:00

1.5 KiB
Raw Blame History

title, category, language, tags
title category language tags
Role Object Structural en
Extensibility

Also known as

Post pattern, Extension Object pattern

Intent

Adapt an object to different clients needs through transparently attached role objects, each one representing a role the object has to play in that clients context. The object manages its role set dynamically. By representing roles as individual objects, different contexts are kept separate and system configuration is simplified.

Class diagram

alt text

Applicability

Use the Role Object pattern, if:

  • You want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface.
  • You want to handle the available roles dynamically so that they can be attached and removed on demand, that is at runtime, rather than fixing them statically at compile-time.
  • You want to treat the extensions transparently and need to preserve the logical object identity of the resultingobject conglomerate.
  • You want to keep role/client pairs independent from each other so that changes to a role do not affect clients that are not interested in that role.

Credits