Dealing with functions not in class Object

Hi,
while i was working on GJ i faced the following problem, when i write a generic class i have to take into my consideration those functions that i want to define for the row type class and not included in class Object (toSting() is in class Object but print() is not). of course every time i want to call print() from the generic class the compiler gives me an error becuz it is not in class Object.. is there anyway to get rid of this problem in a simple way without having to deal with more than one row type ?
thanks everyone

I think I see what you're getting at...the GJ compiler substitues Object for all unconstrained type parameters, and therefore tries to call methods on parametized type objects as if they were simply of type Object.
A solution would be to create a base class (or interface) AbstractRow that declares all the methods you need. Then constrain your parameters against AbstractRow. Eg:
public interface AbstractRow
public AbstractRow rowMethod();
public class MyClass<RowType extends AbstractRow>
public RowType doSomething(RowType rt) {
rt.rowMethod();
I think that should work. I'm not sure what you meant by "without having to deal with more than one row type." If you meant "without having to introduce an inheritance hierarchy," then no, this is not possible in GJ (as far as I can tell). If you meant "without having to write adapters for every single row type," then yes.
shaun

Similar Messages

  • [svn:bz-trunk] 18821: Check-in a minor fix that deals with a missing MessageBroker class ( this could happen in Java/Android clients).

    Revision: 18821
    Revision: 18821
    Author:   [email protected]
    Date:     2010-11-26 07:33:24 -0800 (Fri, 26 Nov 2010)
    Log Message:
    Check-in a minor fix that deals with a missing MessageBroker class (this could happen in Java/Android clients).
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/MessageException.java

    I see some message about a proxy. Have you checked that you can use the proxy from you network?
    If not you should turn the proxy off.
    Timo

  • Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1

    I am trying to build a component which has the ability to instantiate and execute
    an known EJB method on the fly.
    I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
    I know that the EJB I am trying to invoke is deployed and available on the server,
    as I can see it in the console, I also seen to have been able to get the remote
    interface of the object, my problem occurs when I try and access the class object
    so I can perform a create on the object and then execute my method
    The code I have written is below:
    private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
    throws Exception {
         String homeCreate = "create";
         Class []homeCreateParam = { };
         Object []homeCreateParamValues = {};           
    try {  
    //This call seems to work and doesn't throw an exception     
    Object home = pCtx.lookup(pJNDIName);
    //However this call throws a java.lang.ClassNotFoundException
    Class homeBean = Class.forName(pHomeBean);
    Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    } catch (NamingException ne) {             
    logStandardErrorMessage("The client was unable to lookup the EJBHome.
    Please make sure ");
    logStandardErrorMessage("that you have deployed the ejb with the JNDI
    name "+pJNDIName+" on the WebLogic server ");
    throw ne;
    } catch (Exception e) {
    logStandardErrorMessage(e.toString());
    throw e;     
    Any advice would be really appreciated, I'm fast running out of ideas, I suspect
    it has something to do with the class loader but I'm not sure how to resolve it
    Regards
    Jo Corless

    Hello Joanne,
    Congratulations! I'm very happy that you've managed to fix your problem. It's
    always essential to understand how to package applications when deploying on BEA
    WebLogic. Usually, by throwing everything into an EAR file solves just about all
    the class loader problems. :-) Let us know if you have any further problems that
    we can assist you with.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Joanne Corless" <[email protected]> wrote:
    >
    >
    I've fixed it!!!!!!!!
    Thanks to everyone who gave me help!!!!
    The class loader was the culprit which is what I suspected all along.
    As soon
    as I put the 2 jar files I was using into an EAR file the problem went
    away!!!!!
    Thanks again
    Jo Corless
    "Ryan LeCompte" <[email protected]> wrote:
    Hello Joanne,
    As Mr. Woollen mentioned, I also believe it's a problem with the class
    loader.
    You need to be careful how you arrange your EJBs, because WebLogic has
    a specific
    method in which it loads classes in an EAR, JAR, and WAR file(s). Please
    refer
    to http://dev2dev.bea.com/articles/musser.jsp for more information about
    BEA WebLogic
    class loading mechanisms and caveats. Also, try printing out the various
    methods
    that are available on the object that was returned to you via reflection.
    For
    example, use the getMethods() method, which returns an array of Method
    objects
    that you can subsequently cycle through and print out the various method
    names.
    This way you can discover if the class found/returned to you is indeed
    the one
    you intend to locate.
    Hope this helps,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    Rob Woollen <[email protected]> wrote:
    I believe the issue is the home interface class for this EJB is not
    available in the class loader which is doing the reflection.
    If you do:
    getClass().getClassLoader().loadClass(homeInterfaceClassName)
    I suspect it will fail. Reflection still requires that the class be
    loadable.
    -- Rob
    Joanne Corless wrote:
    Hi Slava,
    If I make my code look like you describe below I get a compliationerror telling
    me that
    home.getMethod() is not recognised (no such method)
    If I change it slightly and use
    Method homeCreateMethod =
    home.getClass().getMethod(homeCreate,homeCreateParam);
    The code will compile OK but when executed it still throws a NoSuchMethodException
    Any ideas ?
    Thanks for your help so far
    Regards
    Jo Corless
    Your code should look like
    Object home = pCtx.lookup(pJNDIName);
    Method homeCreateMethod =
    home.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    Regards,
    Slava Imeshev
    "Joanne Corless" <[email protected]> wrote in message
    news:[email protected]...
    Hi Ryan,
    I also wanted to mention that if you do a "header search" in this
    particular
    newsgroup
    with the search query as "reflection", you will see many previousmessages
    regarding
    reflection and EJBs. I believe you could learn a lot from thedifficulties
    that
    others have faced and solved.I tried that and although there was a number of similar cases noneof them
    actually
    seem to fix my issue. Thanks for the suggestion though
    Are the EJBs that you are trying to access accessible via your
    system
    classpath?
    Try to avoid having them accessible via the main system classpath,and
    only bundle
    them in your appropriate EJB jar files (contained in an EAR file,for
    example).Maybe I should have laid the problem out a little clearer.
    I have a number of EJB's bundled up in a JAR file which is hot deployedto
    the
    server. Within this first JAR file is an EJB (SSB) component that
    needs
    to
    be
    able to invoke a known method on another EJB. This second EJB may
    or
    may
    not be
    within the first JAR file but it also will be hot deployed.
    The component trying to invoke the method on the 2nd EJB has to
    be
    able to
    create
    an instance of the 2nd EJB without actually knowing anything bar
    a
    JNDI
    Name which
    is passed in at runtime.
    I can get as far as doing the
    Object home = pCtx.lookup(pJNDIName);
    This returned a class with the name
    "com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
    Impl_WLStub"
    My problem seems to occur when I try and invoke the create method
    Method homeCreate = home.getClass().getMethod("create", new Class[0]);
    My code throws a java.lang.NoSuchMethodException at this point so
    I
    am
    unable
    to progress to the next step of :
    Object bean = homeCreate.invoke(home, null);
    So I can return the instantiated bean back to the calling client.
    Why am I getting the NoSuchMethodException, is is because I am gettinga
    stub
    back rather than the home interface and if so how do I get the truehome
    interface
    from the bean
    Thanks in advance
    Jo Corless

  • How to deal with '$' sign in the class name?

    I want to put my Java Applet game on my homepage. But the server which I set up my homepage doesn't support the file name like XXX$XXX.class, which has '$' sign in the file name. Would anyone can tell me how to deal with this problem? And how can I make the game work on my homepage? Thanks.

    Don't forget, this include both concrete inner classes as well as any anonymous inner classes you create, like
    myButton.addActionListener(new ActionListener()
      // Yada Yada Yada

  • How to print Field name with value of a Class object?

    hi, In C#, I need to print a class field or property name with value without using reflection or string.join method.
    For eg.
    protected void Button1_Click(object sender, EventArgs e)
    List<EmployeeInfo> obj = new List<EmployeeInfo>();
    obj.Add(new EmployeeInfo { eid = 123 });
    obj.Add(new EmployeeInfo { ename = "abc" });
    Response.Write(obj.ToString()); // output must be => ename ="abc" , eid = 123
    public class EmployeeInfo
    public string ename;
    public int eid;
    It need to be resulted as follows automatically with property name and value :
    ename ="abc" , eid = 123
    It need to be resulted with good performance and simple way.

    You could override ToString method in EmployeeInfo class:
    public class EmployeeInfo
    public string ename;
    public int eid;
    public override string ToString()
    return string.Format("ename =\"{0}\" , eid = \"{1}\"", ename, eid);
    protected void Button1_Click(object sender, EventArgs e)
    EmployeeInfo obj = new EmployeeInfo() { eid = 111, ename = "aaa" };
    Response.Write(obj.ToString());

  • Function not returning table object correctly

    Instead of returning a table, my function is returning this:
    SCHEMA_OWNER.TBL_SUMS([SCHEMA_OWNER.SUMS_OBJ])
    Does anyone see a syntax error in my function or the ddl of my table and object types?
    This is a stripped down, simplified version of my function:
    create or replace FUNCTION "F_TEST" (p_skey number, p_start_date date, p_end_date date)
    RETURN tbl_sums
    IS
    tmp_A NUMBER;
    tmp_B NUMBER;
    l_tbl tbl_sums := tbl_sums();
    BEGIN
    SELECT SUM(FieldA), SUM(FieldB)
    into tmpA, tmpB
    from myTable where SKEY = p_skey
    and DATE_VALUE >= p_start_date
    and DATE_VALUE < p_end_date;
    l_tbl.extend;
    l_tbl(l_tbl.count()) := sums_obj(p_start_date, p_end_date, p_skey, tmpA, tmpB);
    return l_tbl;
    END;
    My types are:
    create or replace type sums_obj is object (start_date DATE, end_date DATE, skey NUMBER, SumA NUMBER, SumB NUMBER);
    create or replace type tbl_sums is table of sums_obj;
    Thanks!

    >
    RETURN tbl_kpi
    >
    What is 'tbl_kpi'? That isn't defined anywhere. Your original post said this:
    >
    RETURN tbl_sums
    >
    We can't help you if you don't post what you are really using. Cut & Paste is ok but you have to paste the correct code.
    Your funtion is returning a TABLE but it is NOT PIPELINED. So if you query the function from DUAL you will get a DATASET as the result.
    If you query the function AS A TABLE you will get the 'contents' of the table.
    If you make your function a PIPELINED function then you use PIPE ROW to return each row but the function is still declared to return a TABLE. Maybe that is what is confusing you.
    Try the following sample code to see what the difference is.
    Here are two SQL types based on the EMP table in the scott schema.
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    /Now - here is a function (similar to yours) that returns that EMP_TABLE_TYPE. NOTE: the function IS NOT PIPELINED
    CREATE OR REPLACE function SCOTT.get_emp1( p_deptno in number )
      return emp_table_type
      as
    tb emp_table_type;
    BEGIN
      select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
        bulk collect into tb from emp where deptno = p_deptno;
      return tb;
    end;
    /If I just select the function itself from DUAL I get this:
    select get_emp1(20) from dual
    GET_EMP1(20)
    (DATASET)I can use TOAD or sql developer to examine that dataset and see the records.
    But I can actually query the records by using the TABLE function:
    select * from table(get_emp1(20))
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     SMITH     CLERK     7902     12/17/1980     800          20
    7566     JONES     MANAGER     7839     4/2/1981     2975          20
    7788     SCOTT     ANALYST     7566     4/19/1987     3000          20
    7876     ADAMS     CLERK     7788     5/23/1987     1100          20
    7902     FORD     ANALYST     7566     12/3/1981     3000          20This is a similar function. It returns the same EMP_TABLE_TYPE but it is a PIPELINED function.
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /The ONLY way I can query this function is by using the TABLE function:
    select * from table(get_emp(20))
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     smith     CLERK     7902     12/17/1980     800          20
    7566     jones     MANAGER     7839     4/2/1981     2975          20
    7788     scott     ANALYST     7566     4/19/1987     3000          20
    7876     adams     CLERK     7788     5/23/1987     1100          20
    7902     ford     ANALYST     7566     12/3/1981     3000          20The query of the PIPELINED function is the same and the result set is the same.
    The difference is that the PIPELINED function returns ONE ROW at a time and does NOT need to accumulate a lot of data in a collection before returning it. That collection uses expensive PGA memory and the more data you have the more memory it uses.
    Your function (and my similar one) doesn't return ANY data until it has produced ALL of it. And it uses that expensive PGA memory. What is the point of creating your collection one row at a time and waiting until you have it all before you return it?
    You could easily modify your function and add PIPELINED to the declaration. Then use the PIPE ROW clause to return each row as it is produced. That will eliminate the need for the collection (and memory) within the function.
    You can also then chain the function calls together if you need to.
    See 'Using Pipelined and Parallel Table Functions' in the Data Cartridge Developer's Guide
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28425/pipe_paral_tbl.htm
    There is little use for your function that is not pipelined but returns a table type unless you were storing that table-type in an object column of a table.
    There are many uses for PIPELINED functions.

  • Help with dynamic creation of class object names

    Hi all
    Wonder if you can help. I have a class player.java. I want to be able to create objects from this class depending on a int counter variable.
    So, for example,
    int counter = 1;
    Player p+counter = new Player ("Sam","Smith");the counter increments by 1 each time the method this sits within is called. The syntax for Player name creation is incorrect. What I am looking to create is Player p1, Player p2, Player p3.... depending on value of i.
    Basically I think this is just a question of syntax, but I can't quite get there.
    Please help if you can.
    Thanks.
    Sam

    here is the method:
    //add member
      public void addMember() {
        String output,firstName,secondName,address1,address2,phoneNumberAsString;
        long phoneNumber;
        boolean isMember=true;
        this.memberCounter++;
        Player temp;
        //create HashMap
        HashMap memberList = new HashMap();
        output="Squash Court Booking System \n";
        output=output+"Enter Details \n\n";
        firstName=askUser("Enter First Name: ");
        secondName=askUser("Enter Second Name: ");
        address1=askUser("Enter Street Name and Number: ");
        address2=askUser("Enter Town: ");
        phoneNumberAsString=askUser("Enter Phone Number: ");
        phoneNumber=Long.parseLong(phoneNumberAsString);
        Player p = new Player(firstName,secondName,address1,address2,phoneNumber,isMember);
        //place member into HashMap
        memberList.put(new Integer(memberCounter),p);
        //JOptionPane.showMessageDialog(null,"Membercounter="+memberCounter,"Test",JOptionPane.INFORMATION_MESSAGE);
        //create iterator
        Iterator members = memberList.values().iterator();
        //create output
        output="";
        while(members.hasNext()) {
          temp = (Player)members.next();
          output=output + temp.getFirstName() + " ";
          output=output + temp.getSecondName() + "\n";
          output=output + temp.getAddress1() + "\n";
          output=output + temp.getAddress2() + "\n";
          output= output + temp.getPhoneNumber() + "\n";
          output= output + temp.getIsMember();
        //display message
        JOptionPane.showMessageDialog(null,output,"Member Listings",JOptionPane.INFORMATION_MESSAGE);
      }//end addMemberOn running this, no matter how many details are input, the HashMap only gives me the first one back....
    Any ideas?
    Sam

  • How do I deal with things not working in PS CC?

    I need some advise in how to troubleshoot various difficulties.
    Last time I used Photoshop was like over many years ago like in version 2 or somewhere close to it and I am running into problems with it.
    I  have creative cloud version of photoshop. I have been following tutorials even got the book Adobe Photoshop CC In The Classroom.
    But I keep running into things not working for me.
    I am in the first lesson learning how to open files with the shortcut keys and nothing is happening.
    Yesterday I was trying to follow tutorial in PSDtuts on perspective I found via the learning section of Adobe.
    First issue I had was I think program is geared towards CS6.
    It seems like most tutorials are geared for CS6.
    I have similar tools as CS6 I assume but when I follow along they don't work like the tutorials.
    Example first problem I had was making perspective line with the little triangle tool I can't remember of name of on the top.
    I was suppose to move the line every 2 degrees making more lines but my line kept shrinking until it vanished.
    And then when I was working Vanishing Point I couldn't get feature I wanted in the settings, it was grey out.
    Any pointers in how to resolve this?

    Here is the smallest I can go without losing the image. Ugh sorry the site did scramble the display of words for me for me so you can't see the words. But if you look in PS its in Effects drop down window its there sort of in middle of the list to the end called "Vanishing point."
    Here is the vanishing point tool before and being selected with the grayed out area. Only way to get the graph back in from the tutorial said I need to select "Render Grid to Photoshop" but its grayed out.
    My cap lock wasn't on. It was the ctrl alt shift short cut and I think in that case I didn't understand that it open PS when it was already closed but still seem to be messing up. I thought it was short cut key to open new file.
    I learned about it in this video. http://psd.tutsplus.com/tutorials/drawing/work-with-perspective-photoshop/
    I tried to follow a long for about the whole half hour video and everything I tried. Hope its okay to post links. It was found in the learning section in main site when I did search for perspective. I was trying find another perspective tool. LOL 

  • How to deal with the rule that do not use "object" class to declear a class

    I run my flex project in sonar. And there is a rule "Do not use Object class ".
    I just want to know how to deal with this problem.
    I mean, when I try to write a base class, I don't know which kind of class will be transfered in by reference, which type I can declear instead of "object"?

    Check out this example:
    The moment I put in the code >> box1.addItem("hello"); << and run the application, the BusNameListener is fired. Hope this makes sense.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class JFrameExample {
    private JComboBox box1;
    public JFrameExample() {
    box1 = new JComboBox();
    box1 .setMinimumSize(new Dimension(300, 24));
    box1 .setPreferredSize(new Dimension(300, 24));
    box1.addActionListener(new BusNameListener());
    box1.addItem("hello");
    JFrame f = new JFrame("This is a test");
    f.setSize(400, 150);
    Container content = f.getContentPane();
    // content.setBackground(Color.white);
    content.setLayout(new FlowLayout());
    content.add(box1);
    f.setVisible(true);
    class BusNameListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox) e.getSource();
    String item = (String) cb.getSelectedItem();
    if (item != null) {
    JOptionPane.showInputDialog(null,
    "Specify...", "File Import",
    JOptionPane.OK_CANCEL_OPTION);
    }

  • How do I deal with a Java method which returns a class object?

    Hi, I am using JNI to talk to some Java code from c++;
    I have a java method in class B that is defined as
    class B{
    A[] As;
    A getA(int i){
    return As(i);
    where A is one of my classes.
    I would like to know the code to deal with a returned object of type A and then how to access the variables in A from c++.
    I have defined my method pointer as :
    env->GetMethodID(B, "getA", "(I)A;");and have the jclass object of type A.
    Would I do something like jclass A_CLASS = env->FindClass("A");
    jobject A_OBJECT = (A_CLASS)env->CallObjectMethod(B,getA, i) ; If so, how do I then access the fields in A_OBJECT? Please let me know, thanks.

    ilganeli wrote:
    Thanks but this doesn't really help. I know how this is done in Java (see below).Presumably you also understand how that code will fail. At least based on what you have posted here.
    I do not understand the syntax to do the equivalent thing in JNI, specifically, how to cast the returned object from the CallObjectMethod function to be of the appropriate type, namely A, and then how to access those fields. You don't cast it. Didn't do so in your java code either.
    But you define how you are going to attempt to access any object in JNI. If you mess up it fails.

  • Calling a function in another class that is not the App delegate nor a sngl

    Hi all-
    OK- I have searched and read and searched, however I cannot figure out an easy way to call a function in another class if that class is not the app delegate (I have that down) nor a singleton (done that also- but too much code)
    If you use the method Rick posted:
    MainView *myMainView = [[MainView alloc] init];
    [MyMainView goTell];
    That works, however myMainView is a second instance of the class MainView- I want to talk to the instance/Class already instantiated.
    Is there a way to do that without making the class a singleton?
    Thanks!

    I had some trouble wrapping my head around this stuff at first too.
    I've gotten pretty good at letting my objects communicate with one another, however I don't think my method is the most efficient or organized way but I'll try to explain the basic idea.
    When you want a class to be able to talk to another class that's initialized elsewhere, the class your making should just have a pointer in it to the class you want to communicate with. Then at some point (during your init function for example) you should set the pointer to the class you're trying to message.
    for example in the app-delegate assume you have an instance of a MainView class
    and the app-delegate also makes an instance of a class called WorkClass
    If you want WorkClass to know about MainView just give it a pointer of MainView and set it when it's instantiated.
    So WorkClass might be defined something like this
    //WorkClass.h
    @import "MainView.h"
    @interface WorkClass : NSObject
    MainView *myPointerToTheMainView;
    @property (retain) myPointerToTheMainView;
    -(void)tellMainViewHello;
    @end
    //WorkClass.m
    @import "WorkClass.h"
    @implementation WorkClass
    @synthesize myPointerToTheMainView;//this makes getter and setter functions for
    //the pointer and allows us to use the dot
    //syntax to refrence it.
    -(void)tellMainViewHello
    [myPointerToTheMainView hello]; //sends a message to the main view
    //assume the class MainView has defined a
    //method -(void)hello
    @end
    now somewhere in the app delegate you would make the WorkClass instance and pass it a reference to the MainView class so that WorkClass would be able to call it's say hello method, and have the method go where you want (to the single instance of MainView owned by the app-delegate)
    ex:
    //somewhere in app-delegate's initialization
    //assume MainView *theMainView exists and is instantiated.
    WorkClass *myWorkClass = [[WorkClass alloc] init];
    myWorkClass.myPointerToTheMainView = theMainView; //now myWorkClass can speak with
    // the main view through it's
    // reference to it
    I hope that gets the basic idea across.
    I'm pretty new to Obj-c myself so if I made any mistakes or if anyone has a better way to go about this please feel free to add
    Message was edited by: kodafox

  • Dealing with abstract classes and interfaces with XMLBeans

    I'm quite new to XMLBeans and would like some help. I've got things working when
    you are only saving concreate classes as XML, but when it comes to clesses containing
    interfaces I am running into problems.
    I basically have a collection of XY objects (see below) that I want to save as
    XML.
    I want to convert the following java classes to an xml schema:
    public class XY{
    X x;
    Y y;
    public interface X{
    void setA(int a);
    int getA();
    public interface Y{
    void setB(int b);
    int getB();
    public class X1 implements X{
    void setA(int a);
    int getA();
    //other data to save
    public class X2 implements X{
    void setA(int a);
    int getA();
    //other data to save
    public class Y1 implements Y{
    void setB(int b);
    int getB();
    //other data to save
    public class Y2 implements Y{
    void setB(int b);
    int getB();
    //other data to save
    What would be the best way to convert these to XML Schema? I've looked through
    all the XMLBeans documentation, but it doesn't say anything about dealing with
    interfaces/abstract classes. Is there anywhere else to look?
    Thanks in advance,
    Andrew

    Anurag,
    What I really wanted was a work-around to using substiutionGroups as substitution
    groups are not supported in this release.
    I want to convert the following schema:
    <xsd:complexType name="PublicationType">
    <xsd:sequence>
    <xsd:element name="Title" type="xsd:string"/>
    <xsd:element name="Author" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="Date" type="xsd:gYear"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="BookType">
    <xsd:complexContent>
    <xsd:extension base="PublicationType" >
    <xsd:sequence>
    <xsd:element name="ISBN" type="xsd:string"/>
    <xsd:element name="Publisher" type="xsd:string"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="MagazineType">
    <xsd:complexContent>
    <xsd:restriction base="PublicationType">
    <xsd:sequence>
    <xsd:element name="Title" type="xsd:string"/>
    <xsd:element name="Date" type="xsd:gYear"/>
    </xsd:sequence>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="Publication" type="PublicationType"/>
    <xsd:element name="Book" substitutionGroup="Publication" type="BookType"/>
    <xsd:element name="Magazine" substitutionGroup="Publication" type="MagazineType"/>
    <xsd:element name="BookStore">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="Publication" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    to produce an XML file like:
    <?xml version="1.0"?>
    <BookStore ¡Ä>
    <Book>
    <Title>Illusions: The Adventures of a Reluctant Messiah</Title>
    <Author>Richard Bach</Author>
    <Date>1977</Date>
    <ISBN>0-440-34319-4</ISBN>
    <Publisher>Dell Publishing Co.</Publisher>
    </Book>
    <Magazine>
    <Title>Natural Health</Title>
    <Date>1999</Date>
    </Magazine>
    <Book>
    <Title>The First and Last Freedom</Title>
    <Author>J. Krishnamurti</Author>
    <Date>1954</Date>
    <ISBN>0-06-064831-7</ISBN>
    <Publisher>Harper & Row</Publisher>
    </Book>
    </BookStore>
    What is the best way to do this without using substitution types?
    Thanks,
    Andrew
    "Anurag" <[email protected]> wrote:
    Andrew,
    Could you please paste/attach a sample of the code you are using to convert
    Java bean classes to XMLBeans?
    In the current release the goal of XMLBeans technology was to convert
    from
    XML Schemas or XML files to XMLBeans. The focus was not towards conversion
    of Java beans to XMLBeans.
    Regards,
    Anurag
    "Andrew" <[email protected]> wrote in message news:[email protected]...
    I'm quite new to XMLBeans and would like some help. I've got thingsworking when
    you are only saving concreate classes as XML, but when it comes toclesses
    containing
    interfaces I am running into problems.
    I basically have a collection of XY objects (see below) that I wantto
    save as
    XML.
    I want to convert the following java classes to an xml schema:
    public class XY{
    X x;
    Y y;
    public interface X{
    void setA(int a);
    int getA();
    public interface Y{
    void setB(int b);
    int getB();
    public class X1 implements X{
    void setA(int a);
    int getA();
    //other data to save
    public class X2 implements X{
    void setA(int a);
    int getA();
    //other data to save
    public class Y1 implements Y{
    void setB(int b);
    int getB();
    //other data to save
    public class Y2 implements Y{
    void setB(int b);
    int getB();
    //other data to save
    What would be the best way to convert these to XML Schema? I've lookedthrough
    all the XMLBeans documentation, but it doesn't say anything about dealingwith
    interfaces/abstract classes. Is there anywhere else to look?
    Thanks in advance,
    Andrew

  • Class type 022 is not defined for object for BATMAS

    Hi Experts,
    while creaitng the LSMW for batch classification,I faced the error during IDOC processing as "Class type 022 is not defined for object".I am using
    Business Object      BUS1001002
    Method               SAVEREPLICA
    Message Type         BATMAS
    Basic Type           BATMAS03
    Pleas guide how to resolve the error.
    Also ,as I intend to make LSMW for batch classifications.Is this the correct way.
    Please guide on this also.
    Regards.

    Hello Jass,
    Symptom
    The BATMAS03 basis type (message type BATMAS) /FB BAPI_BATCH_REPLICATE  cannot transfer any classification information. Please review note 1070634.
    First Option :
    You should first transfer the batmas and then the clfmas idoc.
    Second Option :
    You could create the batch together with classification. Normally the problem is the missing CUOBJ_BM in table MCH1. It is not necessary in all situations that the field have to be filled, but it can be in some cases (And it is better to store the right  information in the corresponding fields). Especially when you transfer batch/classification information in other system the field have to be filled.
    The way to create the batch TOGETHER with classification by using BATMAS IDOC is to set the following parameters correctly :-
    set E1BPBATCHCTRL-DOCLASSIFY to X and fill the segments with relevant classification information
    E1BP3060_ALLOCATION
    E1BP3060_VALUATION_CHAR
    E1BP3060_VALUATION_CURR
    E1BP3060_VALUATION_NUM
    In this case the field mch1-cuobj_bm should be filled with correct CUOBJ. You can also use function module BAPI_BATCH_SAVE_REPLICA to create batches together with classification.
    Hope this information helps
    Regards
    Amber

  • JNI to access functions of a dll to deal with a data aquision pci card

    i am trying to do an applicattion to access the functions of a dll
    to deal with a data aquision pci card (Analogig/Digital pci card).
    i�m using jni of course, but i have some problems.
    first i did a class called "TesteDll" witch contains all the native methods to access the functions of the pci card.
    after, i did a "TesteDll.jar" to use these methods in another applicattions.
    everything was fine until there. so created a single program like this:
    TesteDll td = new TesteDll();
    short res1 = td.P1602_DriverInit(wTotalBoards);
    short r = td.P1602_ActiveBoard((short)0); // ativa a placa
    short res2 = td.P1602_GetConfigAddressSpace((short)0,wAddrTimer,wAddrCtrl,wAddrDio,wAddrAdda);
    int dwRepeat;
    for(dwRepeat=0 ; dwRepeat<100 ; dwRepeat++)
    short wRetVal;
    wRetVal = td.P1602_ClearScan();
    wRetVal += td.P1602_AddToScan((short)0,(short)0,(short)1,(short)0,(short)0,(short)0);     // CH:0 to scan
    wRetVal += td.P1602_SaveScan((short)0,wV0);
    wRetVal += td.P1602_AddToScan((short)2,(short)0,(short)1,(short)0,(short)0,(short)0);     // CH:2 to scan
    /* ->error here!*/ wRetVal += td.P1602_SaveScan((short)1,wV2);      
    the programs compile correctly, but in the execution the folowing error was descripted:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x8079A50
    Function=[Unknown.]
    Library=(N/A)
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at TesteDll.P1602_SaveScan(Native Method)
    at Teste2.main(Teste2.java:119)
    Dynamic libraries:
    0x7CD80000 - 0x7CD9D000      C:\WINDOWS\SYSTEM\IMAGEHLP.DLL
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 161K [0x10010000, 0x100b0000, 0x104f0000)
    eden space 512K, 31% used [0x10010000, 0x100385c0, 0x10090000)
    from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000)
    to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
    tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000)
    the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000)
    compacting perm gen total 4096K, used 1044K [0x14010000, 0x14410000, 0x18010000)
    the space 4096K, 25% used [0x14010000, 0x141152e8, 0x14115400, 0x14410000)
    Local Time = Wed Jun 01 10:21:14 2005
    Elapsed Time = 0
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_06-b03 mixed mode)
    functions like "P1602_DriverInit(wTotalBoards)","P1602_ActiveBoard((short)0)" functions correctly.
    i run the same program in c++ builder and everythings goes fine, but i need to do it in java. i don�t know what to do,can you help me?
    thanks

    i almost forgot, i�m using win 98.
    First i used Dev C++ to make the JNI dll and the error ocurred at the first call of "P1602_AddToScan()" function. after i made the jni dll using C++ Builder, and the error ocurred at the second call of "P1602_SaveScan()" function. but the error message in both cases was the same.
    for(dwRepeat=0 ; dwRepeat<100 ; dwRepeat++)
    short wRetVal;
    wRetVal = td.P1602_ClearScan();
    /*First Error - Dev C++*/ wRetVal += td.P1602_AddToScan((short)0,(short)0,(short)1,(short)0,(short)0,(short)0); // CH:0 to scan
    wRetVal += td.P1602_SaveScan((short)0,wV0);
    wRetVal += td.P1602_AddToScan((short)2,(short)0,(short)1,(short)0,(short)0,(short)0); // CH:2 to scan
    /* Second error C++ Builder */ wRetVal += td.P1602_SaveScan((short)1,wV2);
    ...

  • How to call a Derived call fucntion with a base class object ?

    Hi all
    i am working on a JNI interface to Java, and in the process of simulating a C++ behaviour in java
    so i need some help form you people, in this regard.
    here is a c++ code, i need a equivalent fucntionality in java , to put it one word, the question is
    how to implement the dynamic_cast functionality in java, as java also has virtual fucntions, i think
    this should be possible, if it is not, what is the alternative
    class Base
    public:
         Base()
         ~Base()
         virtual void F1()
              cout<<"The BASE::F1() is called"<<endl;
         virtual void F2()
              cout<<"The BASE::F2() is called"<<endl;
    class Derived : public Base
    public:
         Derived()
         ~Derived()
         virtual  void F3()
              cout<<"The Derived::F3() is called"<<endl;
         virtual void F4()
              cout<<"The Derived::F4() is called"<<endl;
    Base * GetDerived()
         return new Derived();
    int _tmain(int argc, _TCHAR* argv[])
         Base *ptr = NULL;
                    ptr  = GetDerived();
         Derived *dPtr = dynamic_cast<Derived *>(ptr);
                    dPtr->F3();
    }regards
    pradish

    Just to clarify a point that I consider important--the distinction between references and objects:
    Your subject is: How to call a Derived call fucntion with a base class object ? The answer to that is: You cannot. It is completely impossible in Java. If you have a base class object, the derivced class' methods are not present. On the other hand, if you have a compile-time reference of the parent type, but at runtime it happens to point to an instance of the derived class, then, as pointed out, you can cast the reference. (Note that casting does not apply to objects.)

Maybe you are looking for

  • Error Message for Photoshop CS7 Trial

    Why do I receive an error message that installer is misconfigured for assistant to Photoshop CS7 after it downloads?

  • Reader X - Floating Toolbar in Browser not functional

    Using Reader X in "recent" Firefox version and IE 9 with Windows 7. When viewing a PDF in either browser, none of the icons in the floating toolbar respond. The cursor arrow changes shape during the rollover of the icons, but clicking on them (print,

  • Handle long-running EDT tasks (f.i. TreeModel searching)

    Note: this is a cross-post from SO http://stackoverflow.com/questions/9378232/handle-long-running-edt-tasks-f-i-treemodel-searching copied below, input highly appreciated :-) Cheers Jeanette Trigger is a recently re-detected SwingX issue (https://jav

  • .INDD files not showing cs4 icon

    ...after an hour on the phone with tech support..I'm turning to the masses. I've right clicked the file/prop/to change the program to open the file type with. Indesign CS4 is not on my program list.  When I select browse/program/adobe/indesign cs4 an

  • Process Data Creator ID not working

    Hi All (and Paul) I want to send an email to the process creator when a request has been approved. The best way to do this, it seems, is to use the "EmailService - Send with Document" activity. In the to field, I do not have the option of process cre