What is the business requirement for Marker Interface
Prasanna Lakshmi Tallapaka
Greenhorn
Joined: May 01, 2010
Posts: 14
posted
0
Hi,
Could any one please be so kind to help me knowing the business purpose for a Marker Interface. Also, need the list of Marker Interfaces in Java. Many thanks for your help!
Prasanna Lakshmi Tallapaka wrote:
Many thanks for your reply. This was implicit and is going on. But not of much help.
Can you explain to us why it didn't help? We can't elaborate on your issue if we don't know why.
And explaining what is a marker interface... etc. when the google links does a good job is just a bit silly.
As for the "business requirement" part of your question, that doesn't really make sense. The "marker interface" is a technique (or pattern, for those who like that terminology). It may be used indirectly to solve a "business requirement", but otherwise, is unrelated.
Thanks for your responses. I am aware of what a marker interface is. But was not aware as which business requirement would drive a technologist to implement it. Otherwise, even it is fine to think that it is just used for the purpose. Eg : java.io.Serializable is a marker interface implementing which serializes an object. Similarly, java.lang.Cloneable. Thought if I could know some more to store in my KB and share with needy.
I would be glad to know the marker interfaces in standard JDK.
There is an essentially infinite number of ways a marker interface could be used (although these days annotations are probably the preferred choice--marker interfaces were always a bit suspect to me). They're used any time there's a need to indicate or implement capabilities or possibilities outside of a strict class hierarchy.
Kaustubh Sharma
Greenhorn
Joined: Mar 02, 2010
Posts: 28
posted
0
I think in business it is used because it is easy to understand which class object is going to be serialzed although for that they don't have to implement any method of it, but it is easy understanding for the coder so the mistakes can be avoided.........
@kaustubh: You're referring to Serializable, I assume. It's not just to "avoid mistakes", it's to tell the JDK that the object may be serialized. And you do need to provide a serialVersionUID even though no methods need to be implemented.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
But was not aware as which business requirement would drive a technologist to implement it.
It is extremely rare for business requirements to drive technology decisions on such a low level, as Henry pointed out.
You can find a (probably incomplete) list of marker interfaces in the FAQ.