About extending parameterized interfaces...

Hi all,
I have a (hopefully?) quick question about generics. I have the following interface:
public interface MessageHandler<T extends Message, S extends NodeInterface> extends Handler {
     public Class<T> getHandledClass();
     public void nowHandle(S ni, T msg);
}Now, I have a whole family of classes that are going to implement this interface, such as the following:
public class LivenessReplyHandler implements MessageHandler<LivenessReply, PardooNodeInterface> {
public class LivenessRequestHandler implements MessageHandler<LivenessRequest, PardooNodeInterface> {
}etc. In each case, the right hand type is always PardooNodeInterface. Now since this is a family of classes, I'd like to do something more along these lines:
public interface PardooMessageHandler<T extends Message> extends MessageHandler {
     public void nowHandle(PardooNodeInterface ni, T msg);
}And then clients simply extend PardooMessageHandler:
public class LivenessReplyHandler implements PardooMessageHandler<LivenessReply> {
public class LivenessRequestHandler implements PardooMessageHandler<LivenessRequest> {
}That is, extending from PardooMessageHandler automatically implies that type S in nowHandle of MessageHandler is of type PardooNodeInterface. Now you may ask "Why don't you just go hard-code PardooNodeInterface into type S in MessageHandler then?" Well, that's because this is just one family of handlers -- in the end, there will probably be a half-dozen more, each using a different type for S.
I feel as this can be done using generics... Just not clear on the syntax :(
Thanks,
shadowmatter

I think this would work:
public interface PardooMessageHandler<T extends Message> extends MessageHandler<T,PardooNodeInterface> {
}

Similar Messages

  • ABAP-OO: Another Layer (1 Interface) vs. extending N Interfaces?

    Hello,
    this is a crosspost from Stackoverflow, any advice greatly appreciated.
    I have an Data-Access Layer (SAP ABAP, but the language does not matter here) where I have 1 interface per entity/database-table, like
    IF_DATA_CONTRACT_HEAD->get_contract_header( )
    IF_DATA_OBJECT_CALC->get_object_calculations( )
    40 more ...
    These interfaces are implemented by the actual database-access class-impls and a generated caching-layer, which is pretty simple since the methods really do not have any parameters and just return "the relevant" data.In certain consumers however, I require a filtered access to the returned data, specifically I need to get the data of all interfaces (~50) constrained by contract-position.So, do you recommend to
    A) extend all interfaces by an optional parameter like IF_DATA_CONTRACT_POSITION-&gt;get_contract_positions() which means my impl and my caching-layer gets more complex
    B) should I create another interface IF_DATA_FILTER_CONTRACT_POSITION->set_contract_position_filter? for the sole purpose of explicitly filtering data-acesss
    A) When extending every existing interface (the ~40-50 listed above) with the optional contract-position filter/constraint, the API is quite clean and would look like the following:
    result = lo_data_object_calc->get_object_calculations( <FILTER> ).
    As already mentioned, it would require me to extend every implementation, the data-access as well as the generated caching-layer.
    B) With the explicit filter-interface IF_DATA_FILTER_CONTRACT_POSITION on the other hand, I would have yet another interface-layer around data-access and I could generate the uncoupled filtering impls. I would neither need to touch the actual data-access impl nor the generated cache-layer. However, the usage would be a little more clumsy, like
    TRY. " down-cast from data-interface to filter-interface
    DATA lo_object_filter ?= lo_data_object_calc.
    lo_object_filter->set_contract_position_filter( <FILTER> ).
    CATCH could_not_cast.
    RAISE i-need-a-filter-impl!
    ENDTRY.
    result = lo_data_object_calc->get_object_calculations( ).

    Update 05.08.2014: I decided to go with
    C) create a seperate filter-object which explicitly filters the tables retrieved by e.g. get_object_calculations( ).
    Reasoning: Separation of Concerns, explicit semantic of filtering, no need to update all interfaces or regenerate caching-layer.

  • Interface extends another interface

    Hi,
    Java has the concept of inheritance for both classes and interfaces.
    For classes inheritance is restricted to single inheritance. For multiple
    inheritance the class should implement an interface.
    But what about interfaces? Is multiple inheritance defined for interfaces?
    If so, is there any documentation on this? Are there OO-design-considerations
    that argue against multiple inheritance for interfaces?
    Thanks for your remark or pointing to literature,
    Sponiza

    You should try it and see. But, not to spoil the surprise, yes Java allows an interface to extend multiple interfaces, and yes, like most everything else there are design considerations to doing this. You might wade through the long discussion here:
    http://forum.java.sun.com/thread.jsp?thread=479908&forum=4&message=2241590
    and hit google or search these fora
    Good Luck
    Lee

  • A few questions about the FCE interface

    I'm new at FCE, but I've done video editing for a few years in Windows (Vegas Movie Studio mostly, it was pretty good but limited in the number of video and audio tracks). I've finally made the jump to Mac and I'm excited getting started. The ability to do keyframes and motion is outstanding and I can't wait to play with LiveType and Soundtrack.
    There's a few things I'm not sure I understand about the FCE interface. I'm working on my first project and it's going to me mostly made up of short (4-10 second) video clips and still photos (with pan and zoom and some motion) and background music. I've done several of these in the past in other software, this project is my learning one for FCE.
    However, I can't understand why some things happen they way they do. If I drag a clip or still from the bin to somewhere in the middle of my existing sequence where there are no items on the video track, it 'parts the seas', moving all video on all tracks to the right and cuts my audio track wide open leaving a huge gap to make room for the clip or still even if it has no audio. The same thing happens in reverse if I'm deleting a still or clip, it chops it out and scoots everything over. I think I want to manage my own gaps rather than FCE trying to manage it for me. Does this have something to do with ripple editing - something that I must not have learned in my Windows video editing experience?
    I've ordered a few tutorial books based on recommendations in this forum, they're on their way. I didn't expect to be immediately proficient, but it seems I'm not understanding something fundamental about the interface.
    There's other questions too, like when I move a video clip from one track to another (up or down, not left or right), why does it move the audio portion of that clip to another audio track? Sometimes it stomps on something I already had on that track. Can't I unlink those somehow?
    When I bring two clips or stills together and attempt to overlap them (which I think should mean I'm doing some type of transition), it seems to just truncate one or the other. I suppose I just need to get used to that?
    Thanks for any suggestions you may have.
    iMac 20" intel   Mac OS X (10.4.10)  

    You need to get comfortable with targeting your tracks and, as mentioned, locking off tracks you don't want to affect.
    You say you want to add a clip/still to the "middle" of a sequence ... I take it there are clips to either side of this spot that you don't want to affect. Then I would set In and Out (I and O) points in the timeline to define the space you want the clip to occupy. If you don't want audio to carry over, then lock off whatever audio tracks you have edited. Then do an Overwrite by either dragging the clip to the far right of the screen to get the Overwrite pop up or by using the F10 key.
    The Delete key to the right of your keyboard (sometimes under the help key) does a ripple delete. The Delete key under the number keys (sometimes a backspace key) removes a highlighted portion of video without rippling the timeline.
    If you lay in a new clip with audio and don't want to affect an existing track, target a separate set .. so if you have a clip on V1 with its audio on A1/A2 and you want to overwrite the video but add new audio, target V1 and A3/A4.
    As to overlapping clips .. if you want to use transitions, overwrite your first clip. Overwrite the second right up against it .. don't try to overlap. Now select your transition and drop it down between the two clips. NOTE: FCE needs handles ... like about a spare 15 frames of info on both clips
    I strongly reccomend Tom Wolsky's book on FCE. It has tutorials and is a great way to start. I've never used Vegas but FCE is a very deep program ... it takes time, practise and patience (and you online manual is a great resource too)

  • Error while extending two interfaces.

    I am using Weblogic Integration 8.5. When an interface extends two interfaces. Out of which one has a clone method declared. <br>
    This IDE is giving error as <br>
    ERROR: Sample.java:3: This type inherits two versions of method java.lang.Object clone(), one from java.lang.Object and another from com.ParentOne, that have conflicting access restrictions. <br>
    <b>Following are code snippets.</b><br>
    public interface Sample extends ParentOne, ParentTwo {} <br>
    public interface ParentOne { <br>
    public Object clone() throws CloneNotSupportedException; <br>} <br>public interface ParentTwo {} <br>
    <b>Same is working fine in other IDE with the bea JDK as well as sun's jdk. </b>
    <br>
    Can anyone help on this? Many Thanks.

    I am using Weblogic Integration 8.5. When an interface extends two interfaces. Out of which one has a clone method declared. <br>
    This IDE is giving error as <br>
    ERROR: Sample.java:3: This type inherits two versions of method java.lang.Object clone(), one from java.lang.Object and another from com.ParentOne, that have conflicting access restrictions. <br>
    <b>Following are code snippets.</b><br>
    public interface Sample extends ParentOne, ParentTwo {} <br>
    public interface ParentOne { <br>
    public Object clone() throws CloneNotSupportedException; <br>} <br>public interface ParentTwo {} <br>
    <b>Same is working fine in other IDE with the bea JDK as well as sun's jdk. </b>
    <br>
    Can anyone help on this? Many Thanks.

  • Information about configuration parameters

    Does anybody know where to find information about these parameters in SXMB_ADM - Integration Engine Configuration?
    - BPE - DISPATCHER - MIN_DURATION_PROCESSING
    - BPE - DISPATCHER - PACKAGES_PER_COMMIT
    Thanks!

    Hi ,
    Please find the below link :
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2016a0b1-1780-2b10-97bd-be3ac62214c7
    Also the SAP Notes :
    1058623
    1233380
    Regards,
    Madhusree

  • Question about extend calendar using scal?  help,help

    recently, we received a mail from sap which saying about extending  calendar using scal;
    I have read sap notes:1529649 , 501670
    and my steps will be:
    1> in our qas system using scal
        change holiday calendar: choose CN China holiday calendar to change and then enter validation from 1995 to 2098(for example)
    2> change factory calendar: choose CN China factory calendar to change and then enter validation from 1995 to 2098(for example)
    3> in scal , choose menu: extras-->update calendar buffer
    4> transport this change to our prd system.
    5> go to scal in prd system to check
    6> update prd system `s calendar buffer in scal
    I do know whether my steps is right?
    I have two questions:
    1> we are a chinese compary, and we use several languages:TRADITIONAL CHINESE , SIMPLIFIED CHINESE and ENGLISH;
         whether i should change other holiday calendar,such as british calendar?
    2> Is there something wrong about my steps?
    thanks a lot.
    Edited by: victor on Nov 29, 2010 6:17 AM

    Hi,
    You are correct, But You can change it on QAS due to client will not modifiable.
    Goto Developement System and run scal.
    Most important is to change/extend factory calander and save it. Request will be generated as Workbench. Transport it to Production System.
    Rgds
    dk

  • I am doing one Labview project. so my project is about design a interface in labview which one collect the data from keithley 2400 via GPIB connection.

    i am doing one Labview project. so my project is about design a interface in labview which one collect the data from keithley 2400 via GPIB connection. any suggestion please

    Your first task should be to just be able to send commands to the instrument.  Do as Dennis suggested and download the drivers for the instrument and get familiar with them.  Build up small VIs that do little tasks with those drivers so you can get used to them.  Then worry about your main interface.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Question about parsing parameters through url

    Hello,
    I have some questions about parsing parameters through a url.
    What I want to build is a page with some text fields and maybe one drop down list. After user enter values into the text fields and select one option in the drop down list, then press the submit button, a report will be opened, which according to the parameters parsed.
    These were what I have done:
    1. create a blank page and a region
    2. create one text field in the region, the name is FIRSTNAME
    3. create one hidden items FN, of which the source value is item FIRSTNAME
    4. create a process. the type is "Set Preference to value of Item" which set PN with the value of FIRSTNAME when the page submitted
    5. create a button "Submit Page and Redirect to URL", in the URL I entered:
    http://dianti.local.net:9704/xmlpserver/~shichao/GuestFolder/orderdetail/orderdetail.xdo?_xpf=&_xpt=0&_xdo=%2F~shichao%2FGuestFolder%2Forderdetail%2Forderdetail.xdo&FIRSTNAME=&FN.&_xt=orderdetail&_xf=pdf&_xmode=4
    My problem is: it seems working for the first time after I entered a value in the FIRSTNAME text field and press submit button, but when I come back to the page (the report was opened in the same page, wondering how to open it in a new window?), the value is saved in the text field and after I enter another value and submit the page again. It still parse the old value to the report. The value of the parameter doesn't change.
    What's the reason? and is this the correct way to build what I want?
    Thank you in advance.
    Best Regards,
    Shichao

    Hi Scott,
    Thank you again for the help.
    But this didn't answer my question exactly. I have tested what you created and the problem remains. When I first time enter a value in the text field and press the button, it goes to page 2, but the parameter didn't parsed. When I go back to page 1 and then click the button again. After that I can see the value I parsed on page 2. Same thing happens when I try to enter a new value. So which means the button has to been pressed twice to parse the parameter.
    Due to the limitation of my knowledge of Apex. I don't know how to fix it. Could you please help me again and hope you understand what the problem is. Thank you very much.
    Shichao

  • Interfaces that extend other interfaces

    I am trying to get a handle on the concept of interfaces extending other interfaces, and I just want to bounce my thoughts off the board and see where it goes. The Sun tutorial doesn't provide a lot of detail that I can see.
    Suppose we have interface A which has 3 methods (signatures), and interface B which extends interface A and adds two methods of its own. Suppose also we have a class C which can implement A or B or both.
    1. Having B extend A provides a heirarchy of types, with A above B
    2. If class C implements interface B, then the extends relationship B has with A forces C to provide implementations for the methods of A as well as B. On this point I am not certain.
    3. Having B extend A allows us to essentially add methods to the interface defined by A without forcing those changes on owners of the classes that already extend A.
    Sound OK? Anywone have anything to add?
    Edited by: Fguy on Aug 27, 2009 7:07 PM

    jverd wrote:
    Fguy wrote:
    >
    3. Having B extend A allows us to essentially add methods to the interface defined by A without forcing those >>changes on owners of the classes that already extend A.Huh? Not sure what you're saying, here, but extending A means we're defining a type that's a specialized or >enhanced type of A. Implementors can implement A if all they need is a run of the mill A, or B if they need the >specialized/enhanced version.Thanks.
    What I meant was that class C implements interface A, and interface B is not a part of the picture yet. Then, by creating a new interface B that extends A, rather than just adding the new methods to A, then you are not forced to add new method implementation to class C right away.That would be one situation in which one might do that. Of course, it's also not uncommon to design the two distinct interfaces from the start
    Ok I'll pick up on that, the situation that led to this thread was me trying to understand why the List interface extends the Collection interface, and why the ArrayList class implements both interfaces. And I eventually decided that designing kind of an arrangement makes sense from the start as you say, because there are probably reasons why you'd want that type heirarchy, or higher level abstraction. with different levels of functionality in the respective implementations. I can't really think of any other reason.

  • Any tutorial about url parameters

    hi
    i search for any tutorial about url parameters and how to use
    it in one page to call every thing just change the url parameter
    and every thing on the page changed like the visibility of
    something ,,,,,
    thanks in advance.

    There are two parts to a URL parameter -
    1. Sending it
    2. Receiving it
    To send it, do this -
    <a href="whatever.php?your_parameter=<?php echo
    $whatever; ?>">This link
    will send the parameter to 'whatever.php'</a>
    To receive it, do this -
    <?php
    $yourVariable =
    isset($_GET['your_parameter'])?$_GET['your_parameter']:'';
    ?>
    That parameter's value is now stored in $yourVariable. The
    isset part tests
    to see if the parameter has been specified at all, and if it
    has not, it
    sets $yourVariable to '', while if it has, it sets
    $yourVariable to the
    value of the parameter. It is functionally equivalent to -
    <? php
    if (isset($_GET['your_parameter'])) {
    $yourVariable = $_GET['your_parameter'];
    } else {
    $yourVariable = '';
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "macnux" <[email protected]> wrote in
    message
    news:etg5ts$ovj$[email protected]..
    > ohhh sorry
    >
    > about PHP

  • Interface extending another interface

    Hi, i seem to have trouble finding on the internet what happends when one interface extends another interface. Can you explain it here or give me some link where i can find such information. Thanks

    have you tried to create on yet?  sometimes the best way to learn is just to do it.
    the truth is, extension of an interface is no different than the extension of a regular class.  when you finally implement your subClassed interface, you will just have to remember to add all unImplemented methods of both interfaces.  generally for soemthing like this its best to just implement multiple interfaces so that you will always know what you need to implement before run time otherwise you are bound to receive a lot of errors for not having implemented those methods.

  • Documetations about the complex interface for business partner

    Hi Folks,
    did anyone knows, were I can find some documentations about "how to use the complex interface for business partner"?
    Kind regards
    Thomas

    The above problems through Notes: 810634 has been resolved!
    The return message is "Instance BJXE001005 belonging to object type BusinessPartnerFS was created".
    But the BP "BJXE001005" has not been established in CRM.
    How to i?
    When i use parameters "roles", the return message is "No update is defined for BP role"?
    How to i?
    Thanks you!
    Do you have any examples I reference to the code?
    Thanks a lot.
    Edited by: Ken.Li on Apr 13, 2008 9:05 AM
    Edited by: Ken.Li on Apr 13, 2008 10:17 AM
    Edited by: Ken.Li on Apr 13, 2008 10:33 AM

  • A question about class and interface? please help me!

    the following is program:
    interface A{
    public class B implements A{
    public static void main(String [] args){
    A a = new B();
    System.out.println(a.toString());
    }i want to ask a question, the method toString() is not belong to interface A, why a can call method toString()? the interface call the method that isn't belong to, why? please help me...

    because a.toString() call the method toString() of class Object because B implements A, but extends Object and in the class Object there is a method toString(). infact if you override the method toString() in class B, a.toString() call toString() in class B.
    try this:
    interface A {}
    public class B implements A
      public String toString()
        return "B";
      public static void main(String [] args)
        A a = new B();
        System.out.println(a.toString());
      }by gino

  • Questions about Extended classic scenario

    Hi gurus,
    I'm working in SRM 5.0, ECS, backend ECC 6.0 (only one backend).
    Everytime a SC is being approved a SRM PO has be created. Then a copy of this PO  has to be created in ECC with document Type ATT and the same number of the SRM PO.
    I have two questions
    First of all I need to know the settings to make in 'Define objects in backend system' (for every purchasing Group and every Category ID, I need to create always PO in backend).
    P.Gr   Category ID  Source System      Internal proc.                              External proc.
            *                 TRDCLNT011         Always external procurement        PO if item data complete, otherwise P.Req.
    Is this correct?
    Secondly I need to understand the logic for number range definition
    SRM Activities
    1 - Define number range for Shopping Cart
    I Need to create a SC number range
    01 1000000000 - 1999999999
    and then associate this range (01) to SHC transaction type ('Int.n' field)
    2 - Define a number range for local PO
    LO 7000000000 - 7999999999
    and then associate this range (LO) to ECPO transaction type ('Int.n' field)
    3- Create a new transaction type 'ATT' (backend PO)
    4 - Define a number range for backend PO
    PO 7000000000 - 7999999999
    and then associate this range (PO) to ATT transaction type ('Int.n' field)
    ECC Activities
    1 - Define a number range for document type ATT
    XX 7000000000 - 7999999999
    and then associate this range (XX) to ATT Document  type 'External
    Is this correct?
    I'd really appreciate your help
    Points will be rewarded
    Thaks in advance
    Best regards
    Gg

    Hi. It all sounds about right.
    I don't think the define backend docs does a great deal in ECS, you always get a PO with extended classic. If you ever want anything but a PO, a reservation for example, you have to not use extended classic for those items.
    The number ranges look OK, although I think you only need 1 number range for the backend/local POs, it should all go in line on its own. It's been a while since I got an ECS system going so it is hard to remember.
    The thing to do is try it in a test system and see what happens.
    If anything goes wrong let us know on SDN what error messages you get and we should be able to help.
    Regards,
    Dave.

Maybe you are looking for

  • Airport Express flakes out with 2+ devices

    I've had the router for quite some time, and it has never given me issues, until I got my iPhone. I've used a Nintendo DS, a Nintendo Wii, and my iBook on it and its great. Now that the logic board failed on my G4 (yup, THAT one), I have a Toshiba la

  • Live Messenger conflicting with new update, no access to Flash Player - Vista

    Ok, first of all I'm not an expert at all with computers but usually figure things out on my own, but this is an issue I cannot figure out. Just yesterday, I downloaded I think not 100% sure, Flash Player 10.1 since I was unable to play videos on you

  • Clone stamp tool error

    I am attempting to use the brush in Photo shop element 8....I am running windows vista. I get error message "could not use the clone stamp tool because the area to clone has not been defined (Alt-click to define source point)" I have never had to Alt

  • How to use compilations trick

    i´ve already checked my compilation albums as "part of acompilation" but still seeing the one song artist in my artist list, anyone suffering the same?

  • Transfer partial asset values from completed asset to AUC/other asset

    Hi All Is it possible to transfer partial asset values from completed asset to AUC/other asset. if yes please let me know how to do that?