Tagged Interface

What is actually meant by Tagged Interface ?
I am writing a class which is implementing an interface.
can i make the interface such a way that its functions are not optionally implemented in the implementing class.
My doubt is that we make implements serializable and most cases we dont implement readObject() or writeObject() , so how is class that is implementing Serializable interface is exempted from implementing these functions
Looking forward for a positive reply
Renjith.

readObject and writeObject are not declared in the
Serializable interface. Serializable does not define
any methods or constants. That is why you don't need
to implement anything. Object I/O code determines
whether or not you class has the readObject and
writeObject methods using reflection.Here's a slightly off-topic question, however. How come writeObject/readObject aren't defined like this:
public Serializable readObject() throws IOException;
public void writeObject(Serializable s) throws IOException;?

Similar Messages

  • Multiple inheritance in tagging interface? Is it possible?

    I saw a code somewhere that goes like this:
    public interface Node extends Serializable, Clonable
    ...Is it possible? I know that Java doesn't allow multiple inheritance and that Serializable and Clonable are tagging interfaces where no method must be implemented by the programmer.

    KamenRiderZX wrote:
    I know that Java doesn't allow multiple inheritanceMore exactly: Java doesn't allow multiple inheritance of implementations. Inheriting multiple interfaces ("implements" for classes, "extends" for interfaces) is fine 'though.

  • How to create Tagging Interface?

    Hello, Java expert around the world, pls help me on this:
    There are a few tagging interface in java's core such as java.rmi.Remote and java.io.Serialization.
    How to create customize tagging interface?

    We need it to mark a class!
    If your class implements Serializable then you are saying it is ok to be serialized.
    It's just a way to indicate that a class is capable of something, to tag it in some way.hmm...a class is capable of something....if a class implement java.io.Serializable, then what are the things that the new class capable to do?
    Where is the functionlity(method, or behaviour)? Since there is no method declared under this interface...

  • Jumpstarting changes with U6:  VLAN tagged interfaces and sysidcfg

    Hello,
    I've been banging my head on U6 for a few days and finally have to give up and cry for help. I can no longer build a jumpstarted server which ends up on a separate VLAN tagged LAN after first reboot.
    I have an existing U5 SPARC jumpstart environment setup. We use VLAN tagging a lot in our environments and by default the only time a non VLAN tagged interface is used is during jumpstart. With the existing jumpstart we are using the following profiles:
    root_password=mypassword
    security_policy=NONE
    timezone=GB
    timeserver=localhost
    terminal=vt100
    network_interface=none {hostname=hostname}
    system_locale=en_GB
    name_service=NONE
    system_locale=CIn the U5 profile we let the jumpstart server obtain its network configuration via DHCP and then obtain the profile above, which excludes all network settings. All the network settings were added as part of a finish script. This worked fine with U5. As far as I can see, with U6 at the point where the sysidcfg is first evaluated it removes the network settings and obviously then kills the jumpstart. So I have had to try a different approach. I have tried both of the following:
    network_interface=PRIMARY { default_route=none protocol_ipv6=no}
    network_interface=PRIMARY { dhcp default_route=none protocol_ipv6=no}However, using either of these causes the ce0, bge0 or whatever to remain defined, instead of the ce200000 and ce206000 interfaces that I have explcitly defined in hostname.ce200000 separately. I also get a number of arp errors on initial reboot, such as
    Nov 20 20:27:29 unknown ip: ip_arp_done: init failed
    Nov 20 20:27:29 unknown /sbin/dhcpagent[44]: configure_v4_lease: cannot set interface flags for ce0: Cannot assign requested addressI don't know if I am barking up the wrong tree but I believe I need to get the server on initial boot (or during finish) to reevaluate a different sysidcfg file. Alternatively, it might need some combination of presence/absence of /reconfigure or /etc/.UNCONFIGURED. I think I might also need to stop /sbin/netstrategy return dhcp specific results (I only use DHCP for jumpstart booting and not for normal boot), but I have no idea how to do that...
    # /sbin/netstrategy
    ufs ce0 dhcpAny help much appreciated!
    thanks
    Paul

    Paul,
    I don't want to suggest that I understand your problem but have you seen the comments about tagged vlans on the Opensolaris LDoms forum?
    Near the bottom of thread [Solaris 10 10/08 (update 6)|http://www.opensolaris.org/jive/thread.jspa?threadID=81505&tstart=0] there is some discussion of tagged vlan support changes with U6.
    It sounds like tagged vlans are going to be a problem with U6.
    have a good weekend,
    Glen

  • Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface.

    Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface. A recent network University policy change. The only way to fix this, is if you use a manual proxy configuration in Firefox. So all 100 + uni iMac's can only use Safari as I would need to do a profile push to all 300 students and I am unsure what file carries the proxy information.

    Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface. A recent network University policy change. The only way to fix this, is if you use a manual proxy configuration in Firefox. So all 100 + uni iMac's can only use Safari as I would need to do a profile push to all 300 students and I am unsure what file carries the proxy information.

  • What's a "tagging interface"?

    Java.util.EventListener is an empty interface, which, the API says, is "A tagging interface that all event listener interfaces must extend."
    I've defined lots of custom event listeners and never extended EventListener. Am I missing something?

    Java.util.EventListener is an empty interface, which,
    the API says, is "A tagging interface that all event
    listener interfaces must extend."
    I've defined lots of custom event listeners and never
    extended EventListener. Am I missing something?If you look at javax.swing.event.EventListenerList, you'll see that its methods take or retrieve instances of EventListener. If you want to dispatch events using this mechanism, which I believe is what Swing uses, you have to extend EventListener.
    Personally, I consider it very confusing that these two are in separate packages. I think it would have been much more useful if the powers that be had defined a package java.util.event, and put generic event-handling classes and interfaces there (including an EventThread class!).

  • Tagging Interfaces

    What is the use of 'Tagging Interfaces' like Serializable or Coleable? They don't even contain any abstract methods to force the class implementing them to implement certain behaviour by over-riding those methods?

    They tell the class that is interested in them to treat the object differently if it implements the interface. For serializable and cloneable (clonable?), they confer extra abilities on the class implementing them, even though those abilities are actually provided from elsewhere. Kind of a creative use of interfaces, it's true.

  • Rate Limit on the MPLS Tag interface

    In MPLS Networks, we generally enable tag-switching IP and MTU (1526) configuration on the specific interface . Say if the above commands are applied in the 2 mb Lease Line Serial interface , How do i rate Limit to 64K ?
    Can anyone provide me this info w.r.t the configuration?
    Regards
    Srikant

    Generic rate-limiting should be possible. Here's a URL explaining how to configure this feature.
    http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_command_reference_chapter09186a00801a7ee1.html#1080850
    Hope this helps,

  • "Tag" interface problem

    Hello all,
    While trying to compile a class file which implements Tag, I get an error import javax.servlet.jsp.tagtext.Tag doesnt exist?
    What jar file do I have to set in classpath for the same?
    Rgds,
    Rex

    No error this time.
    package test;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class TagHelloWorld implements Tag
         private PageContext pageContext;
         private Tag parent;
         public TagHelloWorld()
              System.out.println("seetesh");
         public void hello() throws Exception
              pageContext.getOut().write("Hello World");
              System.out.println("hello");
         public int doStartTag() throws JspException
    return SKIP_BODY;
         public int doEndTag () throws JspException {
              try{
                   pageContext.getOut().write("Hello World");
              catch(Exception ex)
                   throw new JspException("IO Exception");
              return EVAL_PAGE;
         public void release (){}
         public void setPageContext(PageContext p)
    pageContext=p;
         public void setParent(Tag t) {
    parent = t;
         public Tag getParent() {
    return parent;
    The jsp doesnt display anything or writes "hello" to the console.
    Am I missing something?

  • Best Practice Interface Tag or Class Method

    Hi All,
    Just wondering which would win out in terms of efficiency, a tagging interface (say for e.g. "Containable") and then calling:
    if (obj instanceof Containable)or a method in the relevant subclass (which extends throughout a tree of other classes as you'd expect) such as:
    obj.isContainable()The interface would seem to win out in terms of ease of typing, but will it be more efficient in terms of performance?
    Thanks,
    Geoff

    GeoffC wrote:
    Thanks for the replies and information.
    I've seen similar statements before, which is one of the motivations for the original question. If we're required to identify real-world qualities of an object then we cannot escape designing to enable that identification.I'm not clear what you mean by "real world qualities" but, for the most part, we don't need to identify objects because we wouldn't have an object in a given reference unless it had the qualities expected of that class of object.
    When it gets too messy to put all the variance of processing of sub-classes in the class itself the Vistor Pattern sometimes comes to our rescue.
    If we're talking about objects that can have a series of "aspects", as might occur in a game with something which models a game-world "object" we might have what's been called a "cookie jar". Essentially you have a method like:
    public <T> T getAspect(Class<T> aspectClass);If the object doesn't support have the aspect it returns null, if it does it returns an implementation of the interface which represents the aspect.

  • Question about custom tags

    Hi All,
    Please tell me what is differnce between javabean and custom tags.
    thank you.

    Javabean is a data object (or a data holder) whose properties can be accessed using getters, setters - ex getName() and setName()
    JSP custom tags are merely Java classes that implement special interfaces (Tag interface). Once they are developed and deployed, their actions can be called from your HTML using XML syntax. Refer the article http://java.sun.com/developer/technicalArticles/xml/WebAppDev3/
    Cheers,
    Janesh

  • SendRedirect in custom tag

              Hi,
              I have a custom tag that invokes sendRedirect() in the doAfterBody(). I'm curious
              as to why the redirection output is not complete. Here's what I always got:
              start of output ---------------------------------
              HTTP/1.1 302 Moved Temporarily
              Location: http://xenon:7001/ctl/error?WebLogicSession=OtCL5lprXh5wN0S5JJF4GFsDfU
              BKZk40AQ8mluIVsHKw2TcG5xpz|6804183543513756739/167846717/6/7001/7001/7002/7002/7
              001/-1
              Server: WebLogic 5.1.0 Service Pack 8 12/20/2000 16:34:54 #95137
              Content-Length: 481
              Content-Type: text/html
              Set-Cookie: WebLogicSession=OtCL5lprXh5wN0S5JJF4GFsDfUBKZk40AQ8mluIVsHKw2TcG5xpz
              |6804183543513756739/167846717/6/7001/7001/7002/7002/7001/-1; path=/
              Connection: Close
              <html><head><title>302 Moved Temporarily</title></head>
              <body bgcolor="#FFFFFF">
              <p>This document you reque
              -- end of output-------------
              As you can see, the Content Length is huge compared to the incomplete returned
              document.
              Can anyone help please?
              Thanks,
              Iwan
              

    you can pass the response object as argument to your
    method..Thanks for your response!
    Unfortunately I can't change the doEndTag() method parameters as doEndTag() is defined in the Tag interface. But if you mean pass the response object as an attribute of the tag i suppse that is possible.
    However, that's pretty close to the hack I currently have to work around this problem except I'm putting the response object in a request attribute in the page and then retrieving it in the doEndTag() method.
    But I am after something a little cleaner than either of these options..... I'm hoping I can just get the response object from another object I have access to. Any more thoughts?

  • Significance of binding tag in WSDL file

    Hi
    I have written a simple WebService based on JAX -WS , with the help of Sun one Application server i generated a wsdl file for that .
    By seeing the wsdl files i could not able to understand binding tag of my wsdl .
    Could anyone please let me know what is the signifucance of this tag ??
    The genrated one in my case is .
    <binding name="CalculatorPortBinding" type="tns:Calculator">
    </binding>Thank you .

    At a glance:
    Wsdl has two parts: abstract (PortType) and Concrete (bindings)
    The abstract part- tag <portType or tag (<interface since wsdl 2.0) is kind of interface i.e. describes available operations and their signature.
    Obviously to invoke the web-service - we have to know protocol and address .
    The wsdl concrete part desribes it.
    Since there number protocols and almost every protocol can have number parameters then
    wsdl concrete part consists of two parts:
    <binding - describes protocol and defnes necessary protocol parameters
    <service ...><port - defines concrete address and joins with binding (concrete protocol with parameters)
    The most detailed answer you can find by reading wsdl spec :)

  • MARKER INTERFACE WHY?

    hello i madhav new to this forum , i have doubt on marker interface . as it doesnot have any body why we r using that one instead of skipping.Is there any concept behind is there.More about my doubt is Take Example Cloneable Interface it Doesn't Have any Method In it,Clone() method is from Object class,then what is the necessity of implementing the interface .Why it should not be like that.
    what is real technolgy behind MarkerInteface and Why we r going to be used in what situations it will needed.And Lastly is there any method related to Serailizable interface if not what it do .
    marker interface can also called as Tag interface what is tag mean here just saying combing derived classes . i didn't get that one and how it will be .
    if u could explain with example or real time project it would be better for me
    thanks in advance

    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

  • Marker interface use

    In which case Marker interface is getting use plz tell

    Marker Interfaces are giving specification to the JVM about the implementing classes.
    One of the features of the Java programming language is that it mandates a separation between interfaces (pure behavior) and classes (state and behavior). Interfaces are used in Java to specify the behavior of derived classes. Often you will come across interfaces in Java that have no behavior. In other words, they are just empty interface definitions. These are known as marker interfaces. Marker interfaces are also called "tag" interfaces since they tag all the derived classes into a category based on their purpose.
    Some examples of marker interfaces in the Java API include: -
    Java.lang.Cloneable
    A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.
    java.io.Serializable
    Serialization is nothing but s saving the state of an object to persistent storage as byte stream. Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable. To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.
    java.util.EventListener
    A tagging interface that all event listener interfaces must extend.
    java.rmi.Remote
    The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object must directly or indirectly implement this interface. Only those methods specified in a "remote interface", an interface that extends java.rmi.Remote are available remotely.
    Javax.servlet.SingleThreadModel
    Ensures that servlets handle only one request at a time. This interface has no methods. If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method.
    Java.util.RandomAccess
    This Marker interface used by List implementations (ArrayList, Vector) to indicate that they support fast (generally constant time) random access. The primary purpose of this interface is to allow generic algorithms to alter their behavior to provide good performance when applied to either random or sequential access lists.
    Javax.ejb.EnterpriseBean
    The EnterpriseBean interface must be implemented by every enterprise Bean class. It is a common superinterface for the SessionBean, EntityBean and MessageDrivenBean interfaces.
    Reference From Sun Documentation

Maybe you are looking for