String to Library Class conversion

Hi guys, i'm having trouble coming up with a good way to
convert a string to class reference from the library without using
a lookup table in Actionscript 3.0
so say i'd loaded in some data from xml and i need to
generate a new instance of a "Box" from a linked extended Sprite in
the library.
without the string i'd just go var myBox = new Box();
but obviously i can't go var myBox = new "Box"() so i'm kind
of stuck without using a lookup table to convert the string passed
to the appropriate Class linkage.
Any help would be much appreciated,

flash.utils.getDefinitionByName()
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#getDefi nitionByName()

Similar Messages

  • Using callStoredProcedure / callStoredFunction though a library/Class

    Jdev 11.1.1.3.0
    I been using callStoreProdure /call StoreFunction as explained in fusion middleware guide http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#insertedID5. It works perfectly fine.
    As, i have to call the above methods many place at Entity level / View level so i would like to bundle them into a library / class file and using them through the library rather pasting the meothd in all instance where i need them.
    If i try to create a class file containing the above method then it could not resolve getDBTransaction(). With my y limited knowledge of Java i am clue less.
    protected Object callStoredFunction(int sqlReturnType, String stmt,
    Object[] bindVars) {
    CallableStatement st = null;
    try {
    //1. Create a JDBC CallableStatement
    st =
    getDBTransaction().createCallableStatement("begin ? := " + stmt + "; end;",
    0);
    //2. Register the first bind variable for the return value
    st.registerOutParameter(1, sqlReturnType);
    if (bindVars != null) {
    //3. Loop over values for the bind variables passed in if any
    for (int z = 0; z < bindVars.length; z++) {
    //4. Set the value of user-supplied bind vars in the stmt
    st.setObject(z + 2, bindVars[z]);
    //5. Execute the statement
    st.executeUpdate();
    //6. Return the value of the first bind variable
    return st.getObject(1);
    } catch (SQLException e) {
    throw new JboException(e);
    } finally {
    if (st != null) {
    try {
    //7.Close the statement
    st.close();
    } catch (SQLException e) {
    e.printStackTrace();
    thanks
    best regards
    Sanjay Chatterji

    Sanjay,
    Just create a custom base class for your EO/VO (this processes is also described in the fusion developer's guide) and put the method in there.
    John

  • Where are C++ Standard Library Classes for Unicode RFC SDK?

    I have the Unicode RFC SDK and there is a document (sapucdoc.htm) that explains that the C++ standard library classes have SAP_ equivalents. For example:
        string --> SAP_string
    It then says that header files for these classes are named SAP<standard lib name>.hpp. So for the string class:
        string.h --> SAPstring.hpp
    The rfcsdk/include directory does not contain any of the header files.  Where can I find these header files and possibly libraries I need to use the standard C++ libraries with this version of the RFC SDK?
    Thanks.

    Those icons are not accessible directly.
    Try setting the appropriate button type, like following code uses "info light" type to show the "i" icon.
    {cod}
    UIButton *aboutButton=[UIButton buttonWithType: UIButtonTypeInfoLight];
    {code}

  • Code Completion on library class

    I appologize if I have posted this to the wrong forum, I am very new to Java and don't usually post to forums.
    I have created class and then added it to the Libraries in a second project from within NetBeans. When I call the method, it doesn't complete the code. Is there any way to do this? I have tried creating a JavaDoc and then I went to Tools|Java Platform Manager| Javadoc tab and added the folder of the javadoc, and it still doesn't do anything.
    Code
    //library class
    public class arrArray {
    public static Object addToArray(Object objOldArray) {
    Class objElementType = objOldArray.getClass().getComponentType();
    int intNewLength = (java.lang.reflect.Array.getLength(objOldArray) + 1);
    Object objNewArray = java.lang.reflect.Array.newInstance(objElementType, intNewLength);
    System.arraycopy(objOldArray, 0, objNewArray, 0, intNewLength);
    return objNewArray;
    //Project class trying to reference
    import arrArray.*;
    private void GetDatabases(JComboBox objCombo, JTextField objTextTnsFile) {
    Object objConnect = new DBConnectionInfo[0];
    File objTnsFile = new File(objTextTnsFile.getText());
    String strFile = "";
    String strLine = "";
    BufferedReader inputStream = null;
    try {
    inputStream = new BufferedReader(new FileReader(objTnsFile));
    while ((strLine = inputStream.readLine()) != null){
    strFile = strFile + strLine;
    objConnect = arrArray.addToArray(objConnect);
    } catch (java.io.FileNotFoundException ex) {
    JOptionPane.showInternalMessageDialog(this,"File " + objTnsFile.getPath() + " not found.","File Not Found", JOptionPane.ERROR_MESSAGE);
    } catch (java.io.IOException ex1) {
    JOptionPane.showInternalMessageDialog(this,"Could not read file: " + objTnsFile.getPath(),"File Read Error", JOptionPane.ERROR_MESSAGE);
    }

    I appologize if I have posted this to the wrong forum, I am very new to Java and don't usually post to forums.
    I have created class and then added it to the Libraries in a second project from within NetBeans. When I call the method, it doesn't complete the code. Is there any way to do this? I have tried creating a JavaDoc and then I went to Tools|Java Platform Manager| Javadoc tab and added the folder of the javadoc, and it still doesn't do anything.
    Code
    //library class
    public class arrArray {
    public static Object addToArray(Object objOldArray) {
    Class objElementType = objOldArray.getClass().getComponentType();
    int intNewLength = (java.lang.reflect.Array.getLength(objOldArray) + 1);
    Object objNewArray = java.lang.reflect.Array.newInstance(objElementType, intNewLength);
    System.arraycopy(objOldArray, 0, objNewArray, 0, intNewLength);
    return objNewArray;
    //Project class trying to reference
    import arrArray.*;
    private void GetDatabases(JComboBox objCombo, JTextField objTextTnsFile) {
    Object objConnect = new DBConnectionInfo[0];
    File objTnsFile = new File(objTextTnsFile.getText());
    String strFile = "";
    String strLine = "";
    BufferedReader inputStream = null;
    try {
    inputStream = new BufferedReader(new FileReader(objTnsFile));
    while ((strLine = inputStream.readLine()) != null){
    strFile = strFile + strLine;
    objConnect = arrArray.addToArray(objConnect);
    } catch (java.io.FileNotFoundException ex) {
    JOptionPane.showInternalMessageDialog(this,"File " + objTnsFile.getPath() + " not found.","File Not Found", JOptionPane.ERROR_MESSAGE);
    } catch (java.io.IOException ex1) {
    JOptionPane.showInternalMessageDialog(this,"Could not read file: " + objTnsFile.getPath(),"File Read Error", JOptionPane.ERROR_MESSAGE);
    }

  • Use String as name class

    Hello, I have a class name on a string variable, and a method name on other string variable. I would like use this strings to invoke class and it's method, how can i do it? Thanks�����
    For example:
    String class_name = car //name of a class
    String method_name = getOwner // class car method
    // How can I invoke the class and method with this strings?

    // How can I invoke the class and method with this
    strings?Java isn't designed to handle this kind of programming. Java uses strong type checking to make programs more safe. If you often end up wanting to do this why not use a more free-wheeling scripting language instead, such as Groovy,
    http://www-128.ibm.com/developerworks/java/library/j-pg07195.html

  • Is it possible to pass a string representing a class name in java as an arg

    Hi, this is probably a bit of a stupid question, but one that has me quite confused all the same!
    Is it possible to pass a string or class name etc. representing a type of class in java, to a method so that instead of having to redefine a method with say the following args:
    public SolarPanels[] bestPVPanels(int budget, int percent) {
            HashMap<Integer, SolarPanels> panelsMap    = new HashMap<Integer, SolarPanels>();
    }As at present needing to create a methods bestWindTurbine() and many others exactly the same, but for the type, I would instead like to be able to create a method like:
    public Object[] bestRenewable(int budget, int percent, String aClassName) {
            HashMap<Integer, aClassName > renewableMap    = new HashMap<Integer, aClassName >();
    }But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class name, any help or advance would be much appreciated.
    Thanks in advance
    Pat Nevin

    pNev wrote:
    But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class nameIt's not. You can do things like
    Class.forName(classNameInString);But that will only return a Class object.
    And as Java generics are erased at runtime, passing the class name to the method is useless as it is too late to use it anyways.
    Ah, Peter's way is what I was thinking of. Too early in the morning.
    Edited by: Kayaman on 23.6.2010 10:02

  • TAG Library Class Refresh

    If I build a Tag-library class on Weblogic 5.1, and subsequentially update
              and recompile it; how can I get WebLogic 5.1 to use this updated .class? I
              don't want to continually stop and start the service... any ideas?
              

    I figured it out. Under the Configuration/TagLibraries,
    create a CrossTagAttr folder and stick a .vtm file in it. In the
    .vtm file, use the <crosstag_attributes> tag and its
    children. See Configuration/TagLibraries/CrossTagAttr/Spry/Spry.vtm
    for an example.

  • Java Library classes source code

    Hi all,
    Does anyone know where I could find source codes for java library classes. The ones that i am especially interested in finding are the inputStream, inputStreamReader, and BuferedReader classes.
    Thanks and regards,
    Green

    Does anyone know where I could find source codes for
    java library classes. The ones that i am especially
    interested in finding are the inputStream,
    inputStreamReader, and BuferedReader classes.http://java.sun.com/j2se/downloads/index.html

  • Library class to create material in standard material Table

    Hey Hi,
    I need to create a proxy class which will create material in standard Material Table.I cannot find a library class for the same in my tabel ........now want to create it a proxy  library class which would create material in standard R3 table like mara ......
    Please help me out as i am new to ABAP.
    Thanks in Advance,
    Neethu Joy

    Neethu,
    SAP is an enterprise system with a RDBMS under it.  Records are not solely created in core tables (like MARA)... instead a transaction is executed that creates the material.  In the midst of this transaction, a MARA table entry is created as well as numerous other table entries.
    You should look to BAPI_STANDARDMATERIAL_CREATE in t-code SE37.  You can create a proxy from this BAPI - you can even create a Web Service that can be implemented in an external app.

  • Can i see the source of a j2me library class?

    can i see inside of a j2me library class? for example can i see the source of the class javax.microedition.media.control.VolumeControl ?

    see http://forum.java.sun.com/thread.jspa?threadID=5145689&tstart=0

  • Common library class (with injection) for different EJB projects

    I want to write a utility class named DBUtil
    with methods like
    bool checkExist(String tableName, String columnName, String value);This class will use a EntityManager reference to have access to a database.
    The point is that I would like it to be injected the EntityManager corresponding
    to the EJB project where it is used. This is,
    if DBUtil is used in project EJB-A with EntityManager-A then DBUtil accesses
    EntityManager-A, but it accesses EntityManager-B if used in project EJB-B.
    What is the best approach?
    I tried DBUtil having a constructor receiving an EntityManager ref.
    But I failed to instantiate DBUtil from the default constructor of a SessionBean
    in a EJB project. (It is like that default constructor is not used).
    Perhaps I have to deepen into SessioBean lifecycle.
    Any suggestion will be very appreciated.
    JordiBM

    I respond to myself:
    JordiBM wrote:
    I want to write a utility class named DBUtil
    with methods like
    bool checkExist(String tableName, String columnName, String value);This class will use a EntityManager reference to have access to a database.
    The point is that I would like it to be injected the EntityManager corresponding
    to the EJB project where it is used. This is,
    if DBUtil is used in project EJB-A with EntityManager-A then DBUtil accesses
    EntityManager-A, but it accesses EntityManager-B if used in project EJB-B.
    What is the best approach?
    I tried DBUtil having a constructor receiving an EntityManager ref.
    But I failed to instantiate DBUtil from the default constructor of a SessionBean
    in a EJB project. (It is like that default constructor is not used).
    Yes. The constructor of the SessionBean is not the right place to do that.
    The right place is to write a method in the SessionBean class
    annotated with @PostConstruct
    This method is called after the injection has taken place:
    @Stateful
    public class MySessionBean {
       @PersistencyContext
       private Entitymanager em; // the EM of *this* project
       private DBUtil myUtil;  // the utility class of many projects
      @PostConstruct
      public void my_init () {
        myUtil = new DBUtil (em); // we pass it this project's EM.
      public void aMethod () {
        // use myUtil
        myUtil.doSomething();
    }

  • Boolean Array to Hex String - LabVIEW Supplementary Data Conversion Library in version 12 please

    Hello,
    I would like to use the Boolean Array to Hex String.vi in LabVIEW Supplementary Data Conversion Library at http://zone.ni.com/devzone/cda/epd/p/id/3727
    But it is version 4. Can someone give me the library in version 12? Attached herewith.
    Attachments:
    cnvrsion.zip ‏38 KB

    Mass compiled in 8.2.1, which you can open with 2012.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    convrzun.llb ‏65 KB

  • Library class printing troubles

    I am making a library type program with users and books that functions like a library. One of the methods prints all of the loans in the library, this is where i am having trouble
    public String printAllLoans() {
    * return a String representation of all loans from all patrons in the library system, return nothing if no loans
    /*     //Collaborated with Greg
         String printallLoans="";
         String none = "None";
         int index = 0;
         for (; index < this.patronCount(); index++){
              if (((Patron) this.patrons.elementAt(index)).countLoans() > 0)
                   printallLoans.concat(((Patron) this.patrons.elementAt(index)).allLoans());
              //System.out.println("* " + ((Patron) this.patrons.elementAt(index)).allLoans() + "*  and length: " + ((Patron) this.patrons.elementAt(index)).allLoans().length());
         if (printallLoans.length() == 0)
              return none;
         else
              return printallLoans;*/
         int index = 0;
         int totalPrinted = 0;
         for (;index < this.patronCount() - 1; index++){
              if (((Patron) this.patrons.elementAt(index)).countLoans() > 0){
                   System.out.println(((Patron) this.patrons.elementAt(index)).allLoans());
                   totalPrinted++;
         if (totalPrinted >= 0){
              if (((Patron) this.patrons.elementAt(index)).countLoans() > 0)
                   return ((Patron) this.patrons.elementAt(this.patronCount() - 1)).allLoans();
              //if (((Patron) this.patrons.elementAt(index)).countLoans() == 0)
              //     return "None";
         //if (((Patron) this.patrons.elementAt(index)).countLoans() == 0 && totalPrinted == 0)
         return "None";
    *From the patron class:*
    public String allLoans() {
    * return a String representation of all my loans in the library system, if no loans, return "None"
    * (e.g. Books on loan to patron # 0:
    * #: 0 "JAVA STRUCTURES" By: BAILE */
         int amountOnLoan = this.countLoans();
         if (amountOnLoan != 0){
              System.out.println("Books on loan to patron # " + this.patronNumber + ":");
              int bookOnLoan = amountOnLoan;
              while (bookOnLoan > 0){
                   System.out.println(((Book) this.booksOnLoan.elementAt(bookOnLoan - 1)).toString());
                   bookOnLoan--;
                   //System.out.println("Amount on loan: " + amountOnLoan);
         if (amountOnLoan == 0)
              return "None";
         return "";
    public int countLoans() {
    * return my total number of loans
         return this.booksOnLoan.size();
    }When i try to printAllLoans() i want it to cycle through the vector of patrons in the library and if countLoans() > 0 (i.e. their is a book on loan) i want it to print the books that are on loan. But if it cycles through all of the patrons and doesn't find any books on loan i want it to return "None". Right now it will return none when it's not supposed to, here is a sample output.
    Patron Menu
    +1. Add a new Patron+
    +2. Delete a Patron+
    +3. Patron Count+
    +4. Print Patron Catalog+
    +5. Print a Patron's loan+
    +6. Print all loans+
    +7. Exit+
    Please choose an option: 6
    Books on loan to patron # 3:
    +#3 "ON TO JAVA" By: WINSTON+
    None+ <------- This should not be here it should have only printed the book on loan.
    Anyone konw where my code is wrong?

    The method must return a result of type String, that is set by the profs. I need it to print all of the loans, but i dont know of a way to return only one string that will have all of the loans attached to it. So i figured i would print some of them and return the last one so it can be printed (System.out.print(aCatalog.printAllLoans()). Is their a way i can make an empty string that would just concat all of the loans to itself and if it's length is 0 print none?
    Maybe:
    String printallLoans="";
         String none = "None";
         int index = 0;
         for (; index < this.patronCount(); index++){
              if (((Patron) this.patrons.elementAt(index)).countLoans() > 0)
                   printallLoans.concat(((Patron) this.patrons.elementAt(index)).allLoans());
              //System.out.println("* " + ((Patron) this.patrons.elementAt(index)).allLoans() + "*  and length: " + ((Patron) this.patrons.elementAt(index)).allLoans().length());
         if (printallLoans.length() == 0)
              return none;
         else
              return printallLoans;I tried this and it will always return None, looking at the allLoans method, if the user has no loans it will return "none", so the lenth of printallLoans would be 4, not 0. So i changed
    if (printallLoans.length() == 4)
              return none;
         else
              return printallLoans;But this didn't want to work either, sample output:
    ====List all Loans====
    Books on loan to patron # 6:
    #0 "CRACKCOCAINE" By: UOFA
    ====Should read one book====
    ====List all Loans====
    Books on loan to patron # 3:
    #1 "IAMABOOK" By: IMANAUTHOR
    Books on loan to patron # 6:
    #0 "CRACKCOCAINE" By: UOFA
    ====Should read two books====
    ====List all Loans - Books were returned====
    <-------------NOTHING HERE!!!, should have printed None because both books that were on loan were returned.
    ====Should read None====
    Any ideas?

  • Error accessing library class

    Hi,
    I'm new to jdev coming from the eclipse world. I've got a problem when using a library (sapjco.jar).
    Here is what I'm doing: build a news class, start writing
    JCO.Client myConnection = JCO.createClien(....);
    Next step is that jdev wants me to import the package com.sap.mw.jco.JCO which is ok. But after that it tells me that Member "Client" is not found in com.sap.mw.jco.JCO. Well, since I used exact this code with eclipse I know that this message is not true. I importet the library like described in the docs.
    What am I doing wrong?
    thanx, Mirco

    ok, thanx. and here is a snippet of my code:
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    public class SAPConnection {
         JCO.Client mConnection;
         JCO.Repository mRepository;
         public SAPConnection() {}
    * @webmethod
         public String getInfoFromBapi(String PersNummer) {
    Client mconnection;
         try {
         JCO.Client mConnection = JCO.createClient(...);
         mConnection.connect();
         mRepository = new JCO.Repository("SAPJCo", mConnection);
    no matter what I try, I always get an error, that Client could not be found. What is the difference in handling inner classes between eclipse and jdev?
    any ideas?
    thank you for your effort, mirco

  • How to convert a String variable as class name and method name?

    i have two classes
    class Student
    public String insertStudent(String sname)
    { return("Student has been inserted ");     }
    class Teacher
    public String execute(String methodName, String className)
    {  //return statement of the method 'insertStudent' in the class 'Student'; }
    }Now, i have a class with the main method. Here, i would like to call the method *'insertStudent'* of class *'Student'*
    using the method *'execute'* of class *'Teacher',* passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Can anyone please help me out. Thanks
    regards,
    chinglai

    You should have just added that as a comment on your [initial posting|http://forums.sun.com/thread.jspa?threadID=5334953] instead of starting a new thread.
    Now, i have a class with the main method. Here, i would like to call the method 'insertStudent' of class 'Student'using the method 'execute' of class 'Teacher', passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Why oh why? What do you want to achieve?
    Let me tell you: there is a way to do what you try to do, but it's not recommended and should be used only very sparingly. Especially not in anything like your code, that resembles normal business logic (as opposed to an application framework such as Spring, for example).
    Can you explain what exactly you want to do with that? Why should a Teacher be able to call any random method ony any other class. And what good would that do?

Maybe you are looking for

  • Multiple curencies

    Dears, in a flow of my company I have this situation. 1) Intercompany billing the document created has these lines - Customer  391775,55 (eur)    value in SGD XXXXXX - sales         391775,55 (eur)    value in SGD xxxxxx 2) Account payable Vendor SGD

  • Multi-threaded application crashing the VM

    Hi, I have a multi-threaded (about 120 threads) application which crashes without after running for a while. I get this in the windows event viewer Faulting application java.exe, version 0.0.0.0, faulting module kernel32.dll, version 5.2.3790.0, faul

  • EJB3 application error

    Hello, My EJB3 application is deployed (as an EAR file) in Oracel AS 10.1.3 on two Solaris boxes. The two environments are supposed to be identical. The application runs as designed in one environment, while throwing the following exception in the ot

  • Does it matter if my iPhone lightning charger is an apple product or not?

    I want to buy this charger but it wasn't produced by apple, but it is for my iPhone. If I buy it and use it, will it cause any damage for my phone?

  • About to purchase an imac

    I may go ahead and get an imac this week and add Leopard later. Here is my main question: I understand that if I install Windows XP, I need Service Pack 2. My Windows XP cd doesn't come with Service Pack 2 and I'm wondering how to proceed without it.