Exceptions declared as inner class.

1) Is it a good idea to declare
exceptions as an inner class, of a root class, from which it is actually
thrown.?
2. So if there are 6 exceptions which are thrown
from the methods of the root class, I will declare 6 inner exception
classes in that root class.
3. Instead of a root class if I have an interface
is it ok to declare these exception classes in the interface?
4. What do you think about this logic?
There are more Exception classes than our actual classes,
so it looks bad, why don't we put all the exception classes
as inner class in one rootException class?

>
If the API user does not catch the exception and
handle it properly then we cannot do much. That isn't what I asked.
I asked if the application code, not the test code, explicitly has a catch block for each exception.
For example if you have the following exceptions.
            class BaseException
            class Exception1 extends BaseException
            class Exception2 extends BaseException
Then that means you have the following code.
              catch(Exception1 e)
                 // Do something with the exception BESIDES logging it
              catch(Exception2 e)
                 // Do something with the exception BESIDES logging it
  Notice in the above that the catch block MUST do something besides just log the exception. Logging doesn't count.
So does your code do this?

Similar Messages

  • Inner Classes Allowed in EJBs?

    Can I not put an inner class inside my enterprise java beans? If not, why not?
    javax.transaction.TransactionRolledbackException: try to access class com.blueorchid.ejbs.WorkflowtBean$Dummy from class com.blueorchid.ejbs.WorkflowtBean; nested exception is:
    java.lang.IllegalAccessError: try to access class blueorchid.ejbs.WorkflowtBean$Dummy from class blueorchid.ejbs.WorkflowtBean
    java.lang.IllegalAccessError: try to access class blueorchid.ejbs.WorkflowtBean$Dummy from class blueorchid.ejbs.WorkflowtBean

    Nevermind. My mistake was in not declaring my inner class, Dummy, as public. After I declared it as public I no longer received the IllegalAccessError. It appears that one can use inner classes in EJBs. This topic is closed.

  • Inner class vs. imported class

    Hi everyone,
    I have entitiy beans created for a client's web app I'd like to use in the
    web service using WebLogic Workshop 7.0. Say the classes are imported like
    this in the services:
    import com.hoike.clientname.ap.bean.Invoice
    import com.hoike.clientname.ap.bean.Vendor
    Instances of these classes are used in callback methods and some of the
    service methods.
    When I generate the CTRL file, it actually adds those imported classes as
    inner class of the service defined.
    The problem is that when I try to used these services from another service,
    I cannot use the imported classes (as Invoice or Vendor), but instead I have
    to use the inner class (InvoiceService.Invoice or VendorService.Vendor)
    Does WebLogic Workshop 7.0 only allow you to use inner classes? Is there a
    way to use custom classes as method parameters?
    Thanks in advance!
    Makoto

    how do you declare your inner class?
    Is it (public)
    public static class MyInnerClassor (private)
    private static class MyInnerClassor (package)
    static class MyInnerClassor (protected)
    protected static class MyInnerClassTry to change the way you declare the inner class. Use protected or package or public instead.

  • Subclassing inner class

    I have a class with some private fields that I want to access from several other classes, all of which will inherit from one class.
    I could provide public accessor methods but I don't feel it is appropriate in this situation so I thought of creating an inner class with protected accessor methods to the private fields.
    I would like to subclass this inner class from outside the enclosing class, thus giving access to the private fields without altering the public interface of the enclosing class.
    I have written a small sample program to test this idea.
    public class A{
      private String hello = "Hello";
      public A(){}
      public class B{
        public B(){}
        protected String getString(){
          return hello;
    public class C extends A.B{
      public static void main(String[] args){
        A a = new A();
        A.B c = new C();
      public C(){
        System.out.println(getString());
    }However, compiling this gives the error "No enclosing instance of A is in scope" at the constrctor for C.
    Am I trying to do something impossible or stupid, or is there a simple solution?
    Thanks,
    Tristan.

    You need a reference to an instance of class A inside B or C. When you declare an inner class as you did, you can access this reference by A.this, but in this case B cannot be instantiated outside an instance of A.
    You want to refer a class A.B without an instance to A. You can do that by declaring B as static. But in this case you don't have access to non-static members of A. So, you still need a reference to A.
    Here is a possible solution :
    class A {
        private String hello = "Hello";
        public A() {}
        static public class B {
         protected A a;
         public B(A a){ this.a = a;}
         protected String getString() {
             return a.hello;
    public class C extends A.B {
        public static void main(String[] args){  
         A a = new A(); 
         A.B c = new C(a);
        public C(A a) {
         super(a);
         System.out.println(getString());
    }It is working.
    Anyway the entire story seems too complicated for me :-) Redesigning is not allways a bad idea ...
    Regards,
    Iulian

  • HELP: Inner Class vs. Private Member

    I use "javadoc -private" to create documents with inner classes. As a result, all private fields and methods, which I don't need, show up in the same document. Is there any way I can have inner classes without private members?

    how do you declare your inner class?
    Is it (public)
    public static class MyInnerClassor (private)
    private static class MyInnerClassor (package)
    static class MyInnerClassor (protected)
    protected static class MyInnerClassTry to change the way you declare the inner class. Use protected or package or public instead.

  • Inner class access to outer class variables

    class X extends JTextField {
    int variable_a;
    public X() {
    setDocument(
    new PlainDocument() {
    //here i need access to variable_a
    i don't want to make variable_a a static member though, so does anyone know how to do it?

    Generally, you can reference your variable_a just as you would any other variable except if your inner class also defines a variable_a. However, to produce a reference to the enclosing outer class object you write "OuterClassName.this". So, to get to your variable I think you would write "X.this.variable_a". I hope this helps.

  • How to config POF to handle inner class

    Hi, I have the following vo object:
    public class Obj implements java.io.Serializable, PortableObject
    public static class InnerObj implements java.io.Serializable, PortableObject
    1) If i put both classes in the pof config xml, it throws class not found exception for the inner class InnerObj (as expected since there is no separate class files for it). My question is what is the correct way to handle the inner class? Should i just leave it out of the pof config xml and coherence will be smart enough to handle it?
    <pof-config>
    <user-type-list>
    <user-type>
    <type-id>111</type-id>
    <class-name>some.package.Obj</class-name>
    </user-type>
    <user-type>
    <type-id>222</type-id>
    <class-name>some.package.InnerObj</class-name>
    </user-type>
    </user-type-list>
    </pof-config>
    2) Also want to confirm if implement both java.io.Serializable & PortableObject in the vo, coherence will ALWAYS take the portable object serialization if <pof-enabled>true</pof-enabled> is set in the config?
    thanks!

    Hi i got the inner class config to work but now struggling to get it to run from the java client that connects to the cache. Went through the documents, it only made me more confused, so many config files...
    The exception i am getting now is from the java application that connects to the cache, when it tried to do a cache.putAll() it's throwing the following exception:
    An exception occurred while encoding a PutAllRequest for Service=ExtendTcpCacheService:TcpInitiator: java.io.IOException: unknown user type: some.package.Obj
    So far I have done the below to enable POF:
    1) On cache server I made the below changes, and both the cacheserver and extendproxy are running fine now.
    - changed xml to: <pof-enabled>true</pof-enabled>
    - dropped the jar containing the pof objects in the classpath
    - added override pof config xml:
    <pof-config>
    <user-type-list>
    <user-type>
    <type-id>8888</type-id>
    <class-name>some.package.Obj</class-name>
    </user-type>
    <user-type>
    <type-id>8889</type-id>
    <class-name>some.package.Obj$InnerObj</class-name>
    </user-type>
    </user-type-list>
    </pof-config>
    2) On the java project that connects to the cache:
    - changed -Dtangosol.coherence.cacheconfig xml file and added:
    <defaults>
    <serializer>pof</serializer>
    </defaults>
    I am sure i am missing some config somewhere, thank you for your help.
    Edited by: 920558 on Mar 28, 2012 2:15 PM

  • Question about inner class - help please

    hi all
    i have a question about the inner class. i need to create some kind of object inside a process class. the reason for the creation of object is because i need to get some values from database and store them in an array:
    name, value, indexNum, flag
    i need to create an array of objects to hold those values and do some process in the process class. the object is only for the process class that contains it. i am not really certain how to create this inner class. i tried it with the following:
    public class process{
    class MyObject{}
    List l = new ArrayList();
    l.add(new MyObject(....));
    or should i create the object as static? what is the benifit of creating this way or static way? thanks for you help.

    for this case, i do need to create a new instance of
    this MyObject each time the process is running with a
    new message - xml. but i will be dealing with the case
    where i will need a static object to hold some
    property values for all the instances. so i suppose i
    will be using static inner class for that case.The two situations are not the same. You know the difference between instance variables and static variables, of course (although you make the usual sloppy error and call them static objects). But the meaning of "static" in the definition of an inner class is this: if you don't declare an inner class static, then an instance of that inner class must belong to an instance of its containing class. If you do declare the inner class static, then an instance of the inner class can exist on its own without any corresponding instance of the containing class. Obviously this has nothing to do with the meaning of "static" with respect to variables.

  • Null pointer exception with inner class

    Hi everyone,
    I've written an applet that is an animation of a wheel turning. The animation is drawn on a customised JPanel which is an inner class called animateArea. The main class is called Rotary. It runs fine when I run it from JBuilder in the Applet Viewer. However when I try to open the html in internet explorer it gives me null pointer exceptions like the following:
    java.lang.NullPointerException      
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2761)      
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2722)      
    at Rotary$animateArea.paintComponent(Rotary.java:251)      
    at javax.swing.JComponent.paint(JComponent.java:808)      
    at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4771)      
    at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4724)      
    at javax.swing.JComponent._paintImmediately(JComponent.java:4668)      
    at javax.swing.JComponent.paintImmediately(JComponent.java:4477)      
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)      
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)      
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)      
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)      
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)      
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)      
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)      
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)      
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    Do inner classes have to be compiled seperately or anything?
    Thanks a million for you time,
    CurtinR

    I think that I am using the Java plugin ( Its a computer in college so I'm not certain but I just tried running an applet from the Swing tutorial and it worked)
    Its an image of a rotating wheel and in each sector of the wheel is the name of a person - when you click on the sector it goes red and the email window should come up (that doesn't work yet though). The stop and play buttons stop or start the animation. It is started by default.
    This is the code for the applet:
    import java.applet.*;
    import javax.swing.JApplet;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.awt.image.*;
    import java.util.StringTokenizer;
    import java.net.*;
    public class Rotary extends JApplet implements ActionListener, MouseListener
    public boolean rotating;
    private Timer timer;
    private int delay = 1000;
    private AffineTransform transform;
    private JTextArea txtTest; //temp
    private Container c;
    private animateArea wheelPanel;
    private JButton btPlay, btStop;
    private BoxLayout layout;
    private JPanel btPanel;
    public Image wheel;
    public int currentSector;
    public String members[];
    public int [][]coordsX, coordsY; //stores sector no. and x or y coordinates for that point
    final int TOTAL_SECTORS= 48;
    //creates polygon array - each polygon represents a sector on wheel
    public Polygon polySector1,polySector2,polySector3, polySector4, polySector5,polySector6,polySector7,polySector8,polySector9,polySector10,
    polySector11,polySector12,polySector13,polySector14,polySector15,polySector16,polySector17,polySector18,polySector19,polySector20,
    polySector21,polySector22,polySector23,polySector24,polySector25,polySector26,polySector27,polySector28,polySector29,polySector30,
    polySector31,polySector32,polySector33,polySector34,polySector35,polySector36,polySector37,polySector38,polySector39,polySector40,
    polySector41,polySector42,polySector43,polySector44,polySector45,polySector46,polySector47,polySector48;
    public Polygon polySectors[]={polySector1,polySector2,polySector3, polySector4, polySector5,polySector6,polySector7,polySector8,polySector9,polySector10,
                      polySector11,polySector12,polySector13,polySector14,polySector15,polySector16,polySector17,polySector18,polySector19,polySector20,
                      polySector21,polySector22,polySector23,polySector24,polySector25,polySector26,polySector27,polySector28,polySector29,polySector30,
                      polySector31,polySector32,polySector33,polySector34,polySector35,polySector36,polySector37,polySector38,polySector39,polySector40,
                      polySector41,polySector42,polySector43,polySector44,polySector45,polySector46,polySector47,polySector48};
    public void init()
    members = new String[TOTAL_SECTORS];
    coordsX= new int[TOTAL_SECTORS][4];
    coordsY= new int[TOTAL_SECTORS][4];
    currentSector = -1;
    rotating = true;
    transform = new AffineTransform();
    //***********************************Create GUI**************************
    wheelPanel = new animateArea(); //create a canvas where the animation will be displayed
    wheelPanel.setSize(600,580);
    wheelPanel.setBackground(Color.yellow);
    btPanel = new JPanel(); //create a panel for the buttons
    btPanel.setLayout(new BoxLayout(btPanel,BoxLayout.Y_AXIS));
    btPanel.setBackground(Color.blue);
    btPanel.setMaximumSize(new Dimension(30,580));
    btPanel.setMinimumSize(new Dimension(30,580));
    btPlay = new JButton("Play");
    btStop = new JButton("Stop");
    //txtTest = new JTextArea(5,5); //temp
    btPanel.add(btPlay);
    btPanel.add(btStop);
    // btPanel.add(txtTest); //temp
    c = getContentPane();
    layout = new BoxLayout(c,layout.X_AXIS);
    c.setLayout(layout);
    c.add(wheelPanel); //add panel and animate canvas to the applet
    c.add(btPanel);
    wheel = getImage(getDocumentBase(),"rotary2.gif");
    getParameters();
    for(int k = 0; k <TOTAL_SECTORS; k++)
    polySectors[k] = new Polygon();
    for(int n= 0; n<4; n++)
    polySectors[k].addPoint(coordsX[k][n],coordsY[k][n]);
    btPlay.addActionListener(this);
    btStop.addActionListener(this);
    wheelPanel.addMouseListener(this);
    startAnimation();
    public void mouseClicked(MouseEvent e)
    if (rotating == false) //user can only hightlight a sector when wheel is not rotating
    for(int h= 0; h<TOTAL_SECTORS; h++)
    if(polySectors[h].contains(e.getX(),e.getY()))
    currentSector = h;
    wheelPanel.repaint();
    email();
    public void mouseExited(MouseEvent e){}
    public void mouseEntered(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    public void mousePressed(MouseEvent e){}
    public void email()
    try
    URL rotaryMail = new URL("mailto:[email protected]");
    getAppletContext().showDocument(rotaryMail);
    catch(MalformedURLException mue)
    System.out.println("bad url!");
    public void getParameters()
    StringTokenizer stSector;
    String parCoords;
    for(int i = 0; i <TOTAL_SECTORS; i++)
    {               //put member names in applet parameter list into an array
    members[i] = getParameter("member"+i);
    //separate coordinate string and store coordinates in 2 arrays
    parCoords=getParameter("sector"+i);
    stSector = new StringTokenizer(parCoords, ",");
    for(int j = 0; j<4; j++)
    coordsX[i][j] = Integer.parseInt(stSector.nextToken());
    coordsY[i][j] = Integer.parseInt(stSector.nextToken());
    public void actionPerformed(ActionEvent e)
    wheelPanel.repaint(); //repaint when timer event occurs
    if (e.getActionCommand()=="Stop")
    stopAnimation();
    else if(e.getActionCommand()=="Play")
    startAnimation();
    public void startAnimation()
    if(timer == null)
    timer = new Timer(delay,this);
    timer.start();
    else if(!timer.isRunning())
    timer.restart();
    Thanks so much for your help!

  • JLS3: Scope of type parameter and inner class declaration

    The following code:
    class Foo<E>
      class E
        E foo()
          return this;
    }produces this error message:
    $ javac Foo.java
    Foo.java:7: incompatible types
    found   : Foo<E>.E
    required: E
          return this;
                 ^
    1 errorApparently, the type parameter E of the outer class Foo shadows the inner class declaration E. An alternative way to check is to create a new E() in this method, which results in an error message about using a type parameter where a type is expected.
    Of course this code is sick, but I would like to know where this is defined in the JLS3, since I cannot find out in which way this shadowing works. What I've found until now:
    Page 179:
    "The scope of a class' type parameter is the entire declaration of the class."
    Page 190:
    "The scope of a declaration of a member m declared in or inherited by a class type C is the entire body of C, ... "
    Page 132:
    "If a type name consists of a single Identifier, then the identifier must occur in the scope of exactly one visible declaration of type with this name, or a compile time error occurs."
    Section 6.3.1 (Shadowing declarations) specifies the shadowing rules, but does not mention type parameters.
    Any help is appreciated.

    The current behaviour in eclilpse seems to be the one we get if the bug in javac is fixed as described.
    This code compiles
    public class Shadow1 {
         class Foo<E>
           class E
              E foo()
               return this;
    }but this code
            Foo<E>.E foo()
               return this;
             }shows
    Type mismatch: cannot convert from Shadow1.Foo<E>.E to Shadow1.Foo<Shadow1.Foo<E>.E>. E
    Not sure if this error message is correct.

  • Exception handling for eventlistener inner classes in swing application

    Hi,
    This is probably sooo easy I will kick myself when I find out, but anyway here goes...
    I have an inner class thus...
              cmbOffence.addFocusListener(new FocusAdapter() {
                        public void focusGained(FocusEvent e) {
                             cmbOffence_focusGained(e);
                        public void focusLost(FocusEvent e) {
                        try {
                             cmbOffence_focusLost(e);
                        } catch (XMLConfigurationException xce) {
                   });where cmbOffence.focusLost(e) is looking up to a class that throws an exception which should be fatal i.e. the swing app should close. I want to handle this exception gracefully so therefore want to throw the XMLConfiguratinException to the main application class. How do I do this?? I guess this is more of an inner classes question than a swing one per se, but any help would be appreciated.
    Thanks
    Conrad

    I think you're maybe confusing classes and threads. In the typical Swing application the "main" thread finishes after openning the initial window and there really is no main thread to report back to. In fact the dispatcher thread is about as "main" as they come.
    To exit such a program gracefully is usually a matter of cleaning up resources and calling dispose on the main window, which you can perfectly well do from the dispatcher thread.
    I usually wind up with some centralised method to deal with unexpected exceptions, for example as part of my desk top window in an MDI, but it's called from the dispatcher thread as often as from anywhere.

  • How to declared an array of inner class ?

    can we declare array of inner class ?

    for example:
    Country.City.Airport.Flight[] fly = Country.City.Airport.Flight[VALUE];
    fly[0] = ( ( (new Country()).new City()).new Airport() ).new Flight();
    System.out.println(fly[0].toString());
    Class Country {
    Class City{
    Class Airport{
    Class Flight{
    }

  • WARNING: Problem validating implementation class. Exception declaration mis

    I have created sample class using JDevStudio10.1.3
    Added method getX() throws Ex (Ex implements Exception)
    Select class and generated J2EE 1.4 RPC webservices
    Got the warning :
    Generating WSDL and mapping file
    WARNING: Problem validating implementation class. Exception declaration mismatch between Implementation: mypackage.Class3 and Interface: mypackage.MyWebService3. Impl class Method: X declares exceptions not declared by the interface (mypackage.Exp)
    Now When I generated client proxy from the wsdl generated, Ex class is not getting generated.
    Can some one help me please.
    Thanks in advance

    If you are using Ex in the implemetation class, make sure that you also include the same in the interface (or SEI).
    If the implementation looks something like:
    public void doSomething() throws Ex {
    System.out.println("Is there something to do, now ?");
    then the SEI should be:
    public void doSomething() throws Ex, RemoteException;
    If your have ommited Ex, then you will have the warning you are seing, and there wont be any artifact generated for Ex in the WSDL.
    Because the Ex exception was not mapped to any WSDL artifact, there is no way you will see the Ex exception generated on the client side (or proxy).
    I have been able to reproduce your error message, so you should be all good.
    WARNING: Problem validating implementation class. Exception declaration mismatch between Implementation: bugyyy.MyServiceImpl and Interface: bugyyy.MyWebService. Impl class Method: doSomething declares exceptions not declared by the interface (bugyyy.Ex)
    Hope this helps,
    Eric

  • Reason for not allowing static declarations inside an inner class

    Is the reason for not allowing static declarations inside an inner class is due to the fact that it can never be accessed at a class level as the outer class has to create an instance of the inner class and any attributes/methods of the inner class has to be accessed through that.
    Typically, an instance (non-static) variable can never be accessed in a statement or expression inside a static context but the class variable can be accessed inside a non-static context. Given this, shouldnt the static declarations be allowed inside an inner class?
    Correct me if my understanding is wrong.
    Thanks

    I still couldnt get it clearly. Why i cant i have a static value ( variable ) for all the instances of the inner class irrespective of its enclosing instances of it ( i.e outer class instances). Say in this example below,
    class Outer
    static int i = 0;
    public Inner inner = new Inner();
    class Inner // inner class ( non-static nested class )
    int j = 0;
    static final int k = 2; // compile time constants are allowed
    // ininner class
    public void m1()
    j++;
    System.out.println("j is " + j);
    i++
    System.out.println("i is " + i);
    public static void main(String[] arg)
    Outer outer1 = new Outer();
    outer1.inner.m1(); // j will be 1 & i will be 1
    Outer outer2 = new Outer();
    outer2.inner.m1() // j will be 1 again & i will be 2. But I would
    // want j to be 2. Why is this not allowed?
    Looks like something missing..

  • Another exception... Serializing inner classes

    Basically, I am tesing class dynamic loading, which I am failing to do till now using codebase within the local system. This was my original question,,, you can see it here http://forum.java.sun.com/thread.jspa?threadID=581979&tstart=0
    which I did not solve as of yet.
    However, this is a new question:
    Does this error look nice? am I making a mistake when serializing and returning an object of an inner class by a remote call?? I have this code in the server class:
    public Message getMessage()throws RemoteException{
    return new MyMessage();
    private class MyMessage implements Message{
    //code
    }Clinet class:
    Message message=server.getMessage(); //generates ExceptionException :
    java.lang.ClassCastException: cannot assign instance of $Proxy0 to field Server$MyMessage.this$0 of type Server in instance of Server$MyMessage
         at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:1977)
         at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1157)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1918)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
         at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:139)
         at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
         at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
         at $Proxy0.getMessage(Unknown Source)
         at Client.main(Client.java:30)
    thank you very much...

    I believe I need to have a better design as you are
    suggesting...
    I want to have a set of Remote interfaces that can be
    implemented by different ways. These interfaces are
    then distributed for other developpers. Assuming it
    is a chat program where clients send Messages to
    other clients through a server, I would like to have
    each client implement his own RemoteClient in a way
    that suits him using Callbacks. Serializing a class
    that implements Message can be used to have it as
    means to communicate. Dynamic class loading is then
    used to get the classes for different implementation
    of Message that circles the clients.
    Two pieces definitely. The message which is of the group that says "please do this" and the functional part which is "for a given message do this".
    There are probably other parts as well.
    In that form, I wanted to test serializing anonymous
    Messages, but it did not work because the enclosing
    class will also be serialized (if it implemented
    Serializable of course) or would throw an exception
    if it does not implement it like the one in the
    questions above as I have learned. Even if Inner
    classes are used it still will not work. Only normal
    classes, or static inner classes would work.
    If the "functionality" is truly general then there probably should be only one message. It would have attributes something like this...
    - Function request name
    - List of function parameters.
    - List of function results.
    After getting answers to my problems, as always, I
    end up meeting new problems, I have these questions:
    How to serialize Actions(AbstractActions,
    ActionListeners)??What is an "action" and why do you need to serialize it?
    If it is a message then make it a message.
    How can I serialize this:
    button.addActionListener(new ActionListiner(){
    public void actionPerformed(ActionEvent e){You don't. At least not in terms of your above problem description.
    This code is gui code. It is neither a message nor a "function". You don't send guis somewhere else.
    /// or this
    button.addActionListiner(new MyAction());
    static class MyActionExtends implements
    ActionListener{
    public void actionPerformed(ActionEvent e){
    //code
    }Again you don't. I suspect you are mixing functionality.
    Your gui should talk to your message layer. You might even have a gui layer, a message layer and a message-gui layer.
    How can I overcome this problem?? Sending a GUI
    through RMI looks very nice!!! with Buttons that
    perform Remote Actions!!
    Based on your system description above it is simply wrong.
    Maybe there is more to your system though.

Maybe you are looking for

  • How can I call my ipad 2 on facetime with my Iphone 4s with the same Apple ID ?

    Hey' I'm french so i will try to explain my problem in English. I've got an Iphone 4s and an Ipad 2, and I want to use Facetime between then. But I've the same apple ID on both devices.. And when I call my iphone the app just open and close 2 seconds

  • Photoshop CS: using a shape to adjust a single part of an image

    I have a pic with a palm tree being lit by a string of christmas lights. I have adjusted the image to may taste but the area where the lights are have too much light. I saw a tutorial about 4 months ago where the instructor used a shape to modify a c

  • Default interface command for SG50052

    Hello  I am trying to set an interface back to its defaults but with no success at all. Actually is a trunk interface and I want to make it access again. With no switchport mode and then switchport mode trunk I get a message about wrong VLAN assignme

  • F1 & F2 interfaces in generic extractors using function module

    Hi experts, I created generic extractor using copy of function module RSAX_BIW_GET_DATA_SIMPLE with Delta capability. In ROOSOURCE, DataSource Extraction Method showing as F2. I checked In some blogs that we need to change the DataSource Extraction M

  • Good site for Video Editing tools (open source)

    I'm a recent convert to Mac, and I'm having a hard time finding comparable tools to what is available via open source on the Windows side. Specifially in the H.264 arena. There are a multitude of open source encoding tools for Windows. I'm sure there