Skip to content

Commit e413b11

Browse files
committed
2 parents 6e0b3e3 + be3f4dc commit e413b11

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

marker/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
layout: pattern
3+
title: Marker Interface
4+
folder: marker
5+
permalink: /patterns/marker/
6+
categories: Design
7+
tags:
8+
- Java
9+
- Difficulty-Beginner
10+
---
11+
12+
## Intent
13+
Using empy interfaces as markers to distinguish special treated objects.
14+
15+
![alt text](./etc/MarkerDiagram.png "Marker Interface")
16+
17+
## Applicability
18+
Use the Marker Interface pattern when
19+
20+
* you want to identify the special objects from normal objects
21+
* define a type that is implemented by instances of the marked class, marker annotations can not do that
22+
23+
## Real world examples
24+
25+
* [javase.7.docs.api.java.io.Serializable](https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html)
26+
* [javase.7.docs.api.java.lang.Cloneable](https://docs.oracle.com/javase/7/docs/api/java/lang/Cloneable.html)
27+
28+
## Credits
29+
30+
* [Effective Java 2nd Edition by Joshua Bloch](https://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683)

0 commit comments

Comments
 (0)