Search Results

Search found 2 results on 1 pages for 'bastan'.

Page 1/1 | 1 

  • Java extends classes - Share the extended class fields within the super class.

    - by Bastan
    Straight to the point... I have a class public class P_Gen{ protected String s; protected Object oP_Gen; public P_Gen(String str){ s = str; oP_Gen = new Myclass(this); } } Extended class: public class P extends P_Gen{ protected Object oP; public P(String str){ oP = new aClass(str); super(str); } } MyClass: public class MyClass{ protected Object oMC; public MyClass(P extendedObject){ oMc = oP.getSomething(); } } I came to realize that MyClass can only be instantiated with (P_Gen thisObject) as opposed to (P extendedObject). The situation is that I have code generated a bunch of classes like P_Gen. For each of them I have generated a class P which would contains my P specific custom methods and fields. When I'll regenerate my code in the future, P would not be overwritten as P_Gen would. ** So what happened in my case???!!!... I realized that MyClass would beneficiate from the info stored in P in addition to only P_Gen. Would that possible? I know it's not JAVA "realistic" since another class that extends P_Gen might not have the same fields... BY DESIGN, P_Gen will not be extended by anything but P.... And that's where it kinda make sens. :-) at least in other programming language ;-) In other programming language, it seems like P_Gen.this === P.this, in other word, "this" becomes a combination of P and P_Gen. Is there a way to achieve this knowing that P_Gen won't be extended by anything than P?

    Read the article

  • Migrating Ajax web application to web socket

    - by Bastan
    Hi, I think i'm just missing a little detail that is preventing me from seeing the whole picture. I have a web application which use ajax request every x time to update client with new information or tasks. I also have a long running process on the server which is a java computation engine. I would like this engine to send update to the client. I am wondering how to migrate my web app to using websocket. Probably phpwebsocket or similar. Can my server 'decide' to send information to a specific client? It seems possible looking at the php-websocket. Can my java backend long process use the websocket server to send notification to a specific client. How? well I can say that my java app could use a class that could send over websocket instead of http. But how the websocket server knows to which client to send the 'info'. I am puzzle by all this. Any document that explain this in more details? It seems that the websocket could create an instance of my web application. Thanks

    Read the article

1