aspose file tools*
The moose likes Java in General and the fly likes Why Marker Interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why Marker Interface?" Watch "Why Marker Interface?" New topic
Author

Why Marker Interface?

Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
Hi All,

When we say that Marker Interface has no methods, why do we need it at all?

Why should we have a interface with NO methods and implement it?

Please answer me! Thanks!

- Mani


Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

This is asked often. Have a search through the forum, you will find plenty of answers.
[ August 08, 2005: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

What is a "marker" interface?
Marker Interface pattern
c2.com - Marker Interface
experts.about.com - Marker Interfaces
The Purpose of the Marker Interface
Maximize your Design ROI with Marker Interfaces and JavaDoc
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
http://www.coderanch.com/t/377400/java/java/marker-interface

<repeat>
A marker interface is used to inadvertantly introduce a design flaw.
A marker interface is typically better described as "metadata" with some contractual properties associated with it.
For example, you could eliminate the java.io.Serializable marker interface and introduce a Serializable annotation with associated contract (i.e. in the javadoc), since it is annotations that are the correct tool for metadata, and prior to 1.5, mere javadoc; it has never been interfaces, despite the flaws that are evident in the core API.
</repeat>


Tony Morris
Java Q&A (FAQ, Trivia)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why Marker Interface?