mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 20:59:07 +00:00
4108f86177
* 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>
29 lines
941 B
Markdown
29 lines
941 B
Markdown
---
|
|
title: Marker Interface
|
|
category: Structural
|
|
language: en
|
|
tags:
|
|
- Decoupling
|
|
---
|
|
|
|
## Intent
|
|
Using empty interfaces as markers to distinguish special treated objects.
|
|
|
|
## Class diagram
|
|

|
|
|
|
## Applicability
|
|
Use the Marker Interface pattern when
|
|
|
|
* you want to identify the special objects from normal objects (to treat them differently)
|
|
* you want to mark that some object is available for certain sort of operations
|
|
|
|
## Real world examples
|
|
|
|
* [javase.8.docs.api.java.io.Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)
|
|
* [javase.8.docs.api.java.lang.Cloneable](https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html)
|
|
|
|
## Credits
|
|
|
|
* [Effective Java](https://www.amazon.com/gp/product/0134685997/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0134685997&linkCode=as2&tag=javadesignpat-20&linkId=4e349f4b3ff8c50123f8147c828e53eb)
|