Inheritance and Interface invocation Query

interface IProduct{
     void getProductName();            
abstract class Option implements Product{
             void exercisePrice();
             void premiumPaid();
class Option1 extends Option{
           // Implement all abstract methods defined in Option and IProduct.
class Option2 extends Option{
     // Implement all abstract methods defined in Option and IProduct.
class Trade{
           public Trade(IProduct p){
     p.getProductName()   // I can only get this method behaviour.
                // My Query
                // I also need to invoke the methods exercisePrice() and premiumPaid() defined in Option1 and Option2
                // If I use instanceof,the code will get cluttered and ugly.
                                 if p instanceof Option1
                                 Option1 op1 = ((Option1) p);
                                 op1.exercisePrice();
                                  if p instanceof Option2
                                  if p instanceof OptionN
class TestHarness{
         public static void main(String args[]){
         // Create an option
         Option1 option1 = new Option1();
         // Trade in the product
         Trade trade = new Trade(option1);
         Query:
         The Trade constructor defines IProduct.
         IProduct can be a concrete Bond,Option,CDS,IRS etc.
         How do I get the methods defined in subclasses Option1 and Option2 or for any concrete subclass of IProduct?
         Is there a way of dynamically invoking the methods of the object created?
        Or do I need to change the design.
}

It looks to me like you're violating the Liskov Substitution Principle.
"The LSP says that the users of base classes should not have to do anything special in order to use derivatives."
- R. MartinThis also violates the Open/Closed principle, because whenever you add a new Option concrete class, you're going to have to update your Trade class (it's not "closed to modification" when the environment around it changes).
The "fix" is just that its not a good idea to force the polymorphism by using instanceof. You should either:
1. Get rid of the IProduct interface completely and treat each product type separately.
2. Reconsider your base class (in this case, IProduct) to see if it really can contain additional behavior applicable to all products.
The previous post about the visitor pattern is interesting, but I don't see how it applies to this example (perhaps some more light could be shed there by the poster).

Similar Messages

  • Java inheritance and interface code help required

    please help me I need your 30 mins only,,, working on assignment and I am trying to understand interface and inheritance might not need even 30 mins, please add me on skype *[deleted by moderator]*
    Or add me on
    yahoo msgr *[deleted by moderator]*
    waiting for your help.
    I have no single person friend or I can ask help from who knows java or programming. pretty much want to learn need a friend who can guide me in java.
    unfortunately have to submit assignment tomorrow.
    Thank you in advance for your time and consideration.
    Akee
    *Edited by moderator: EJP on 10/11/2012 10:38: removed your private contact details. This is a public forum, not a personal help desk. Ask your questions here or not at all.*

    Hi,
    there are lot of thread alredy posted please serach
    check following link
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/1d753cab14a909e10000000a11405a/frameset.htm
    XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    Links of blogs on java mapping...
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    blog
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping(file to xslt mapping)
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners(xslt with java enhancement function)
    Regards,
    Amit

  • About Inheritance and interface!

    I have to write a PQueue2 class which implements PriorityQueue interface, also PQueue2 has to extend BinaryHeap,
    so at the top of the PQueue2 I should have this right?
    public class PQueue2 extend BinaryHeap implements PriorityQueue {

    I meant that if PQueue2 extends BinaryHeap
    then it can call directly all the functions in the
    e BinaryHeap right? but it can also add new methods?It's more like the public and protected methods in BinaryHeap are also the methods of PQueue2. If I create a PQueue2 outside of either class, I can call any public method defined in BinaryHeap on PQueue2.
    the extends keyword creates an "is a" relationship between a class and the class it extends. Every PQueue2 instance is an instance of BinaryHeap (but not the other way around.)

  • A question about inheritance and overwriting

    Hello,
    My question is a bit complicated, so let's first explain the situation with a little pseudo code:
    class A {...}
    class B extends A{...}
    class C extends B {...}
    class D extends C {...}
    class E extends B {...}
    class F {
      ArrayList objects; // contains only objects of classes A to E
      void updateObjects() {
        for(int i = 0; i < objects.size(); i++)
          A object = (A) objects.get(i); // A as superclass
         update(A);
      void update(A object) { ... }
      void update(B object) { ... }
      void update(D object) { ... }
    }My question now:
    For all objects in the objects list the update(? object) method is called. Is it now called with parameter class A each time because the object was casted to A before, or is Java looking for the best fitting routine depending on the objects real class?
    Regards,
    Kai

    Why extends is evil
    Improve your code by replacing concrete base classes with interfaces
    Summary
    Most good designers avoid implementation inheritance (the extends relationship) like the plague. As much as 80 percent of your code should be written entirely in terms of interfaces, not concrete base classes. The Gang of Four Design Patterns book, in fact, is largely about how to replace implementation inheritance with interface inheritance. This article describes why designers have such odd beliefs. (2,300 words; August 1, 2003)
    By Allen Holub
    http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html
    Reveal the magic behind subtype polymorphism
    Behold polymorphism from a type-oriented point of view
    http://www.javaworld.com/javaworld/jw-04-2001/jw-0413-polymorph_p.html
    Summary
    Java developers all too often associate the term polymorphism with an object's ability to magically execute correct method behavior at appropriate points in a program. That behavior is usually associated with overriding inherited class method implementations. However, a careful examination of polymorphism demystifies the magic and reveals that polymorphic behavior is best understood in terms of type, rather than as dependent on overriding implementation inheritance. That understanding allows developers to fully take advantage of polymorphism. (3,600 words) By Wm. Paul Rogers
    multiple inheritance and interfaces
    http://www.javaworld.com/javaqa/2002-07/02-qa-0719-multinheritance.html
    http://java.sun.com/docs/books/tutorial/java/interpack/interfaceDef.html
    http://www.artima.com/intv/abcs.html
    http://www.artima.com/designtechniques/interfaces.html
    http://www.javaworld.com/javaqa/2001-03/02-qa-0323-diamond_p.html
    http://csis.pace.edu/~bergin/patterns/multipleinheritance.html
    http://www.cs.rice.edu/~cork/teachjava/2002/notes/current/node48.html
    http://www.cyberdyne-object-sys.com/oofaq2/DynInh.htm
    http://www.gotw.ca/gotw/037.htm
    http://www.javajunkies.org/index.pl?lastnode_id=2826&node_id=2842
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=001588
    http://pbl.cc.gatech.edu/cs170/75
    Downcasting and run-time
    http://www.codeguru.com/java/tij/tij0083.shtml
    type identification
    Since you lose the specific type information via an upcast (moving up the inheritance hierarchy), it makes sense that to retrieve the type information ? that is, to move back down the inheritance hierarchy ? you use a downcast. However, you know an upcast is always safe; the base class cannot have a bigger interface than the derived class, therefore every message you send through the base class interface is guaranteed to be accepted. But with a downcast, you don?t really know that a shape (for example) is actually a circle. It could instead be a triangle or square or some other type.
    To solve this problem there must be some way to guarantee that a downcast is correct, so you won?t accidentally cast to the wrong type and then send a message that the object can?t accept. This would be quite unsafe.
    In some languages (like C++) you must perform a special operation in order to get a type-safe downcast, but in Java every cast is checked! So even though it looks like you?re just performing an ordinary parenthesized cast, at run time this cast is checked to ensure that it is in fact the type you think it is. If it isn?t, you get a ClassCastException. This act of checking types at run time is called run-time type identification (RTTI). The following example demonstrates the behavior of RTTI:
    //: RTTI.java
    // Downcasting & Run-Time Type
    // Identification (RTTI)
    import java.util.*;
    class Useful {
    public void f() {}
    public void g() {}
    class MoreUseful extends Useful {
    public void f() {}
    public void g() {}
    public void u() {}
    public void v() {}
    public void w() {}
    public class RTTI {
    public static void main(String[] args) {
    Useful[] x = {
    new Useful(),
    new MoreUseful()
    x[0].f();
    x[1].g();
    // Compile-time: method not found in Useful:
    //! x[1].u();
    ((MoreUseful)x[1]).u(); // Downcast/RTTI
    ((MoreUseful)x[0]).u(); // Exception thrown
    } ///:~
    As in the diagram, MoreUseful extends the interface of Useful. But since it?s inherited, it can also be upcast to a Useful. You can see this happening in the initialization of the array x in main( ). Since both objects in the array are of class Useful, you can send the f( ) and g( ) methods to both, and if you try to call u( ) (which exists only in MoreUseful) you?ll get a compile-time error message.
    If you want to access the extended interface of a MoreUseful object, you can try to downcast. If it?s the correct type, it will be successful. Otherwise, you?ll get a ClassCastException. You don?t need to write any special code for this exception, since it indicates a programmer error that could happen anywhere in a program.
    There?s more to RTTI than a simple cast. For example, there?s a way to see what type you?re dealing with before you try to downcast it. All of Chapter 11 is devoted to the study of different aspects of Java run-time type identification.
    One common principle used to determine when inheritence is being applied correctly is the Liskov Substitution Principle (LSP). This states that an instance of a subclass should be substitutible for an instance of the base class in all circumstances. If not, then it is generally inappropriate to use inheritence - or at least not without properly re-distributing responsibilities across your classes.
    Another common mistake with inheritence are definitions like Employee and Customer as subclasses of People (or whatever). In these cases, it is generally better to employ the Party-Roll pattern where a Person and an Organization or types of Party and a party can be associated with other entities via separate Role classes of which Employee and Customer are two examples.

  • Inheritance vs Interfaces

    Hi,
    I know that interfaces are used to create an empty class which cannot be instantiated as it is not implemented. The user will have to eventually implement all or some of the methods defined. Now my problem lies here...cant' the user simply use inheritance and then override the method/s which he/she wants to behave differently from the parent class? I mean whats the reason/s for having interfaces, and what are the differences between inheritance and interfaces?
    I apologize for asking such a simple question but still cant understand the basic concept after I Googled it out.
    Thanks for your attention
    Dave
    Edited by: BeginnerDave on Aug 19, 2009 6:12 AM

    BeginnerDave wrote:
    I know that interfaces are used to create an empty class which cannot be instantiated as it is not implemented.Sort of, but I prefer to think of it as a type rather than a class. The Interface defines a type and the methods that must be implemented for it. A blueprint, if you like.
    The user will have to eventually implement all or some of the methods defined.Actually, in order for it to be instantiated, all methods will have to be implemented.
    Now my problem lies here...cant' the user simply use inheritance and then override the method/s which he/she wants to behave differently from the parent class?Yup. But not everything fits neatly into an inheritance structure.
    I mean whats the reason/s for having interfaces, and what are the differences between inheritance and interfaces?Lots; but just for starters: A class can implement many interfaces, but it can have only one superclass.
    So basically, you go for interfaces when you want to share empty classes....and inheritance when you want to modify class type ...I think you need to read a bit more about this.
    Inheritance is only applicable when one class is a specialized form of another: eg:
    Shape-->Circle
    Mammal-->Primate-->Human
    Product-->Cereal-->CornFlakes
    Interfaces can be implemented by any class in any combination, and it then takes on the type of that Interface, which is why it's perfectly legal to say:
    List myList = new ArrayList();because List is an interface, and ArrayList is a class that implements List.****
    HIH a bit.
    Winston
    ****(BTW, it's better to use generics when defining Lists, but I didn't want to clutter the example).

  • Service Interface Date Query

    Hi -
    I am having trouble selecting records through a view object's service interface based upon specifying a date+time in the query.
    I have a legacy table that has, among other fields, a DATE field. I create a view object on the table with a query (no entity object) and generate a service interface for the view. The web service interface works great for selecting on the non-date fields, e.g.:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="/rt/model/common/types/">
    <ns1:findContact>
    <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
    <ns2:filter>
    <ns2:group>
    <ns2:item>
    <ns2:attribute>ContactName</ns2:attribute>
    <ns2:operator>=</ns2:operator>
    <ns2:value>bobishisname</ns2:value>
    </ns2:item>
    </ns2:group>
    </ns2:filter>
    <ns2:findAttribute>ContactTime</ns2:findAttribute>
    </ns1:findCriteria>
    </ns1:findContact>
    </soap:Body>
    </soap:Envelope>
    successfully returns the response data:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/>
    <env:Body>
    <ns0:findLastCustomerContactResponse xmlns:ns0="/rt/model/common/types/">
    <ns2:result xmlns:ns2="/rt/model/common/types/" xmlns:ns1="/rt/model/common/"
    xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:ContactSDO">
    <ns1:ContactTime>2012-02-14T14:59:02.0-08:00</ns1:ContactTime>
    </ns2:result>
    </ns0:findContactResponse>
    </env:Body>
    </env:Envelope>
    However, when I add the item to restrict the ContactTime, the time component is dropped, and only the date is used in the filter.
    For example, this request payload does not return a result (ContactTime greater than 12pm on 2012-02-14):
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="/rt/model/common/types/">
    <ns1:findContact>
    <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
    <ns2:filter>
    <ns2:group>
    <ns2:item>
    <ns2:attribute>ContactTime</ns2:attribute>
    <ns2:operator>></ns2:operator>
    <ns2:value>2012-02-14T12:00:00.0-08:00</ns2:value>
    </ns2:item>
    </ns2:group>
    </ns2:filter>
    <ns2:findAttribute>ContactName</ns2:findAttribute>
    </ns1:findCriteria>
    </ns1:findContact>
    </soap:Body>
    </soap:Envelope>
    However, this request payload (ContactTime greater than 2012-02-13) does:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="/rt/model/common/types/">
    <ns1:findContact>
    <ns1:findCriteria xmlns:ns2="http://xmlns.oracle.com/adf/svc/types/">
    <ns2:filter>
    <ns2:group>
    <ns2:item>
    <ns2:attribute>ContactTime</ns2:attribute>
    <ns2:operator>></ns2:operator>
    <ns2:value>2012-02-13T12:00:00.0-08:00</ns2:value>
    </ns2:item>
    </ns2:group>
    </ns2:filter>
    <ns2:findAttribute>ContactName</ns2:findAttribute>
    </ns1:findCriteria>
    </ns1:findContact>
    </soap:Body>
    </soap:Envelope>
    returns the record:
    <ns1:ContactName>bobishisname</ns1:ContactName>
    In the view object, I can set the attribute type on the ContactTime field to Timestamp, but it does not affect the behavior. I cannot modify the underlying table to change from DATE to TIMESTAMP.
    How do I set up the view object so that the service interface correctly passes the time component to the database and execute the query correctly?

    The select query is for fetching entry sheet number is:
    select ebeln belnr bwart bewtp menge xblnr lfbnr mwskz shkzg srvpos packno from ekbe
            into corresponding fields of table it_ekbe
              for all entries in it_ekko
                where belnr in s_belnr
                  and lfbnr in s_lfbnr
                  and ebeln = it_ekko-ebeln
                  and bwart = '101'
                  and bewtp eq 'E'.      "for service acceptance no. (GR no.)
    Here I have taken lfbnr as entry sheet number.

  • Use of events and interface in class

    Dear All,
    Could you please explain why we use events and interface in class.
    Also please tell me the use of TRY and ENDTRY.
    Regards,
    Amar

    Events may be a way of communication b/w classes. Imagine you want to call certain code from one class, you would need for that public method, but you don't want to expose it to external user. So you may use events for that. Also events are used to notify that certain state of class has changed (tiggering event). Then all handlers of this event executes and react accordingly.
    Interfaces are a way of provide a service to class which implements it. Imagine that you have class office and hotel and gas station . They don't seems to have something in common. However, there can be some external energy provider which will be an interface. Each class which want to have a lease with this energy provided can implement it (the implementation can differ in some way), so he can provided energy to different classes. This way you will achieve polimorphism (meaning you call one interface method, but code behind it differs from class to class).
    Interfaces are also means of multiple inheritance. One class can implement several service (interfaces). In contrary it can oly inherit from one class.
    Try endtry are just new way of handling exceptions .
    Try to search a litte bit you will find lots of info on the above.
    Regards
    Marcin

  • Inheritance and access control - "private protected"

    I'm reopening an old topic, seems to have been last discussed here 2-3 years ago.
    It concerns the concept of restricting access to class members to itself, and its subclasses. This is what "protected" does in C++ and "private protected" did in early versions of the Java language. This feature was removed from Java with a motivation along the lines of not being "simple", and "linear" (in line with the other access modes, each being a true subset of the next). Unfortunately, the article which explained Sun's position on this keyword combination seems to have been removed from the site, so I haven't been able to read its original text.
    But regardless of simplicity of implementation or explaining Java's access modifiers to newbies, I believe it is a fundamental part of OO programming for such an access mode to exist. The arguments for having the standard "private" mode in fact also apply for having a C++-style "protected" mode. (Arguing that classes within a package are related and it therefore doesn't hurt to also give them access to Java's "protected" members, is equally arguing that "private" is unneccessary, which noone of course believes.)
    The whole concept of inheritance and polymorphism and encapsulation builds on the access modes private, protected, and public (in the C++ senses). In Java the "package" concept was added - a nice feature! But I see no justification for it to negate the proper encapsulation of a class and its specializations.

    What effect upon inheritance other than hiding members
    from subclasses is there?
    None. And I cant think of another declaration that prevents members from being inherited but private.
    Of course the onus comes on the programmer with Java's
    definition of "protected" - but
    1) there is rarely a single programmer working within
    a package
    The point was the package is a unit which does not hide from itself. Just like all methods within a class can see each other, all classes within a package can, and all packages within a program can.
    2) it muddies the encapsulation in the design - when
    you see a "protected" method someone else, or yourself
    some time ago - wrote, how do you know if the design
    intention is to have it accessed solely by the class
    and its subclasses, or if it is indeed intended to be
    shared with the whole package? The only way to do
    this today is to always explicitly specify this in the
    comments, which may be lacking, inconsistent, and
    abused (since it isn't enforced).Encapsulation would be implementation hiding. Not method hiding. The only thing you should probably allow out of your package is an interface and a factory anyway.
    I understand where you are coming from, but I really have not had occasion to take issue with it. I can't think of a real codeing situation where this is required. OTOH, I can't think of a coding situation where I need to access a protected method from another class either.

  • Abstract classes and Interfaces

    Why would you use these? Why not make a concrete class and extend them? I see why JAVA doesn't use mutiple inheritance but I don't see how allowing interfaces correctes that, after all what happens if two interfaces implemented by one class have two fully defined methods with the same signature but differant outputs?
    I tryed googleing this but just got articles on when to use Abstract over interface and interface over abstract, which should have helped some but it didn't.
    Can someone explain or post a link for a good example.

    Why would you use these? Why not make a concrete
    class and extend them? Check out the JDBC interfac (java.sql package).
    The core Java API defines what types and methods it wants to use for DB interactions. But because every DB and driver is so different, there's no concrete implementation that the core API could provide for those types. It's up to the vendors to provide all the "how"--all the concrete implementations of the methods.
    interfaces correctes that, after all what happens if
    two interfaces implemented by one class have two
    fully defined methods with the same signature but
    differant outputs?That rarely happens (it has never happened to me in about 8 years of Java programming) and if it does, you just have to find a different approach--you can't meet both contracts.

  • About Classes and Interfaces

    How can we define the classes and interfaces in an interview can u give me any realtime example for this

    How can we define the classes and interfaces in an
    interviewThe easiest explanation probably is to say that an interface in Java is a special class, namely a totally abstract one, that has been given a separate name.
    Classes and interfaces (because they're classes in disguise) both constitute types, meaning that variables can be declared of them. The difference is that a class can carry implementation whereas an interface cannot (because it's totally abstract).
    Java has single inheritance of implementation which means the the inheritance of classes is restricted to exactly one while you can inherit as many interfaces you like.

  • Inheriting and the "super" keyword

    I found a case where "super" is not working as I understand it should...
    Can someone explain me the underlying theory that makes JAVA behave this way??
    public class Base {
         public void method1() {
              System.out.println("method1 from \"Base\" class. About to call method2.");
              method2();
         public void method2() {
              System.out.println("method2 from \"Base\" class. About to call method3.");
              method3();
         public void method3() {
              System.out.println("method3 from \"Base\" class.");
    public class Extension extends Base {
         @Override
         public void method1(){
              System.out.println("method1 from \"Extension\" class. About to call super.method2.");
              super.method2();          
         @Override
         public void method2(){
              System.out.println("method2 from \"Extension\" class. About to call method3.");
              method3();          
         @Override
         public void method3(){
              System.out.println("method3 from \"Extension\" class.");                    
    public class Main {
         public static void main(String args[]) {
              System.out.println("In \"The Java Programming Language,\n" +
                        "Fourth Edition By Ken Arnold, James Gosling, David Holmes\"\n"+
                        "chapter: 3.3: \"Inheriting and Redefining Members\""+
                        " says:");
              System.out.println("Using super is the only case in which the type of\n" +
                        "the reference governs selection of the method implementation\n" +
                        "to be used. An invocation of super.method always uses the\n" +
                        "implementation of method the superclass defines (or\n" +
                        "inherits). It does not use any overriding implementation of\n" +
                        "that method further down the class hierarchy.\n");
              System.out.println("But by running this code, i get:");
              System.out.println("------------------------------------------");          
              Extension ext = new Extension();
              ext.method1();          
              System.out.println("------------------------------------------");
              System.out.println("\nWHY??? I was expecting:\n"+
                        "method1 from \"Extension\" class. About to call super.method2.\n" +
                        "method2 from \"Base\" class. About to call method3.\n" +
                        "method3 from \"Base\" class.");          
    THANKS!!

    IgnacioKriche wrote:
    But I used "super", so this means to use the methods of the super class and I understand that a method called within another, is part of this last one. this is:
    if inside method 'x', method 'y' is called, then 'y' is part of 'x' . Agree? And therefore since I am using super I'm saying use 'x' method from super class since 'y' is part of 'x' then super applies for 'y' as well so what is method from the extended class doing here? It's like we have a mix between the 'x' from super and 'y' from the extended. Something like super only applies for the first level not at a deeper level (a method called from another)No. Just because the base class method2() invokes method3() does NOT mean it will always invoke base's version of method3. If it did that, then polymorphism would definitely be broken.
    You explicitly invoked super.method2(), so that told the compiler to explicitly use the base class version of that method. But then method2 in the base class invokes method3(). That ends up invoking the overridden version in the subclass, by design, because afterall the actual object whose methods are being executed is a subclass instance. If it didn't do that, then polymorphism would be broken for everyone else.
    If you think you need the behavior you are looking for, you are just designing it wrong in the first place.

  • Target and Source Table - Query from ODI Repository

    Hi folks,
    Can anybody help me? I am trying to query the following from an ODI 11g work repository:
    All tables and for each table the tables that are listed in designer as “filled by” (don’t know the exact translation as I am using a german ODI designer) – in other words “all tables and the tables they are depending on”. The reason is to perform a connect-by query on that.
    There is a solution published on ODIEXPERTS: http://odiexperts.com/interface-mapping-query, but however it does not show me the expected results. Does anyone have an idea how to get a simple table like that:
    TARGET          SOURCE
    TAB1           TAB2
    TAB1           TAB3
    TAB2           TAB4
    TAB3           TAB5
    TAB3           TAB6
    TAB6           TAB7
    Using the Metadata Navigator is no option as we don’t have Weblogic installed and I need the data for further processing.

    If memory serves you have an SNP_POP table still in that release, join to the Model table (the joins cols are obvious if I recall) to get the datastore names and your more or less there.
    I dont have that table in 11.1.1.5 and we moved over a while back so cant really take a look anytime soon.

  • Parameterized inheritance and implementation

    I'm learning generics, and I'm having a problem getting the following to work
    I have a base class with some data/behavior
    public abstract Base<E> {
    //...Then there is a concrete class that extends Base and implements Map
    public Concrete<E extends Object & Map<K,V>> extends Base<E extends Object & Map<K,V>> implements Map<K, V>{
    //...I cannot seem to specify that the type for Base must be a Map<K, V>.
    I've thought about containing and delegating, but really Concrete IS-A Base and Concrete IS-A Map.
    Am I missing something about inheritance and generics?
    Any suggestions?

    James,
    Based on your previous posts I think you understand generics as well as I do, and in some aspects, probably better.
    I was trying to capture my thought processes (and that is quite hard since mostly this happens sub-consciously - its quite hard to drag it up into consciousness then document it, but the effort was worthwhile for me and hopefully for others as well).
    In this particular case, E is Map<K,V>, but there could be all sorts of relationships between the type variables, the idea is to identify these and back substitute them, slowly getting rid of type variables until you can't get rid of any more. The ones you are left with are the ones that need to be type parameters.
    take the other post from yesterday
    http://forum.java.sun.com/thread.jsp?thread=554360&forum=316&message=2719355
    as another worked example...
    from
    "And I'm trying to create a special generic container (List) which would only take elements that
    implement the Keyable interface above. For example:
    public class ListOfKeyables <E extends Keyable> extends AbstractList<E>{..."
    and
    "Now, besides standard List methods that use type varable 'E' in their definitions, I would also
    like to have a special method like this:
       public E getByKey(Object key)   {   ... "
    I would start with (ignoring their "E extends Keyable" suggestion, its too premature for that).
    public class ListOfKeyables < ???? > extends AbstractList<E> {
        public E getByKey(Object key) { ... }
    } but "only take elements that
    implement the Keyable interface" suggests replacing E with Keyable<K> thus
    public class ListOfKeyables < ???? > extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(Object key) { ... }
    Note In this case the substitution getting rid of E introduced another type variable (K), thats OK, its still a step toward a solution.
    Then the original poster said "But I would like to constrain the 'key' argument in this method to be of type that is specified as a type parameter to the Keyable interface"
    So after implementing this requirement we have
    public class ListOfKeyables < ???? > extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(K key) { ... }
    }At this point there is no more substitutions or requirements to fulfill.
    So we look through and see what type variables are still unresolved. These (in this case there is only one K), are then the type parameters of the class, and thus we have what I suggested in that post
    public class ListOfKeyables <K> extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(K key) { ... }
    }As a final step, we need to look at the type parameters and decide if they need any constraints (K extends something), These might come from some use of the type parameter ( such as if Keyable constrained its K parameter, we would need to do the same), or from the application requirements. But in this case, there are not any.
    At a certain level of abstraction, this process is not a whole lot different to the process you use when working out what parameters a method or constructor needs (and that process also tends to happen below the consciusness threshold).
    In really simplistic terms, the answer to both "what parameters do I need" questions is "all the ones you can't get from somewhere else or derive from the ones you already have".
    Bruce

  • Difference between abstract classes and interfaces

    I actually wonder about what are the differences between abstract classes and interfaces may somebody give an example code about it?
    and i have one more question how can i use interfaces like multiple inheritance ? i mean when i implement an interface like
    class a extends b implements c,di have to use all c and d methods but what that methods means?
    I mean as i know we cannot make implementations of methods in interfaces
    but for example in runnable interface there is a method like run() and it has been defined somewhere because it knows what to do(i mean when it will run), i just write my code into that method .

    Once you get past the starting point (I am referring to the OP here), there are a few salient differences:
    You can only extend (or generalize) a single superclass; however, you can implement (or realize) multiple interfaces. As such, all things being equal, using an interface in lieu of an abstract class 'frees' your design. Later, if you want the implementor of an interface to inherit from another class, there is not issue.
    Any abstract method specifies a contract. However, abstract classes allow you to also add common behavior to subclasses. This is an overused justification for abstract classes, IMO. You can achieve the same effect using delegation and still having interfaces.
    Always program to interfaces wherever possible. This means that you define an interface and have an implementing class (usually at a minimum). Do not do this for all your classes, but rather the ones that make your system unique (the domain model or M in MVC architecture). This allows you to later change implementation with a minimal amount of refactoring. This is a core precept from the Group of Four and any number of decent programming books.Best of luck.
    - Saish

  • Table with overview inherited and redefined method of class

    Hi,
    is there a table that indicates which method is inheriting the method of the superclass and which method is redefined ?
    I'm having a superclass with a lot of methods and a lot of subclasses.
    Now i'm checking every subclass separately if the methods are inherited or redefined. A table would be great.
    best regards,
    Hans

    In Class builder you can group them as per the Super Class and Interface methods.
    Go to SE24, open your class
    Utilities > Settings > Class Builder
    Select the Checkbox "Group By Interfaces and Superclasses"
    Redefined methods would appear with Black Color in the Group.
    You can also find the Redefined methods in the table SEOREDEF.
    Regards,
    Naimesh Patel

Maybe you are looking for

  • How do you change the direction of a Tween Wipe effect

    Hi all, Completely new to the forums and I hopefully my query is straight forward.  How do you change the direction in the pre-built tween effects available within Flash CS3 (primarily the Wipe effect).  Example code: var Animate_Box:Tween = new Twee

  • Embedding Flash in Swing

    Hi Flash community I am researching on having the Flash application embedded in the Java Swing GUI. An approach seems to have the Http client view to load the flash url. But are there any additional technologies from Adobe? How extensive is the integ

  • ::: Users problems in Solaris 10 SPARC :::

    Hi people, I have finnished an installation of Solaris 10 and also an application from Cisco which is MGC 9.7(3) and I am not able to login as mgcusr via ssh. I checked the group file and passd file and everything is fine. How can I change the mgcusr

  • Info record and source list mandatory for PO creation?

    Hi Gurus, Client wants to make Info record and source list mandatory for PO creation? If Inforec and source list not available for that material, then user can't able to create PO. How can I achieve this requirement? Any user exit available? pls help

  • How do I point to the iTunes file that lists purchase history?

    My iTunes library got messed up and I've been able to point back to most of my settings but do I point to the iTunes file that lists purchase history? Perhaps I'm pointing to an old iTunes library by mistake?