View RSS Feed

Java Object

Tagging Interfaces

Rate this Entry
by , 04-26-2012 at 07:12 PM (1071 Views)
Extending interfaces use which is very common occurs usually when no methods are present in the parent interface. E.g, in java.awt.event package the MouseListener interface extended the java.util.EventListener, which will be defined as following:
Java Code:
package java.util;
public interface EventListener
{}
Interfaces that haven’t any methods present are the tagging interfaces. Tagging interfaces have two main design purposes:

A common parent is created:
Tagging interfaces are used for creation of one common parent among interfaces groups just they way it is done in EventListener interface that is being extended by the other interface’s dzones present in Java API. E.g, when EventListener is extended by an interface, JVM is well aware that this interface will be used in case of delegation scenario.

To a class, data type is added:
This kind of situation is present when the term tagging is used. Class which will be implementing the tagging interface has no need for any method definition however an interface type is made by the class via polymorphism.

Submit "Tagging Interfaces" to Facebook Submit "Tagging Interfaces" to Digg Submit "Tagging Interfaces" to del.icio.us Submit "Tagging Interfaces" to StumbleUpon Submit "Tagging Interfaces" to Google

Comments