File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 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] ( ./marker/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 )
You can’t perform that action at this time.
0 commit comments