How to find classes implementing a certain interface at runtime

I am making an Application and I want have a plug-in nature for the different tools I have.
My App is packaged in a package with subpackages for the individual tools. I want to beable to remove/add subpackages without crashing the app.
The only way I can see this working is for the App to search its sub packages for a certain interface (eg an 'AddOnTool' interface) and build a set of available AddOnTools.
I just dont know if this is possible, but pretty sure it must be!....
Once I have the set of available AddOnTools I also realise that I have to Construct the one chosen, this I see as my other hurdle!
If I can be helped with these I'll be mighty Happy!

You can use getClassLoader() in the Class class to get the ClassLoader, then use getPackages() to get an array of all packages available to your class. How to get a list of all classes, however, I can't find in the documentation; perhaps you can do more research.

Similar Messages

  • How to find (classes,interface,subpackage info) in some package

    Plz tell me if any one know how to find (classes,interface,subpackage) in some package
    e.g. in java.io
    "Above senerio in not concern with java doc
    but tell me if an other way i.e by help of programming
    i could find some package information"
    as we know we find out any "object" classType , methods and fields information with help of "java.lang.reflect" API's
    but how to find a package information as provided by jdk is in current use

    You can locate the .zip or .jar file where the stuff is, and say either
    unzip -l classes.zip
    or
    jar tvf classes.jar.
    So you see the list of the classes in the given package.
    Then you can say
    javap -classpath classes.zip MyPackage.MyClass
    to see the fields and methods of the given class.

  • How to Find Classes Urgent!

    I have loaded .class files using classLoader ..
    i want to find calsses & interfaces which are present in perticular package structure(in memory)..if i use Package.getPackages() mathod
    its returning me all the packages which are loaded in memory.using that package structure how to find the
    classes and interface's
    Advance Thanx

    the problem is that its to hard to track the each classes and its packages.. i have more then 20 jars..each jar having morethen 25 classes with diff packge structure.. (more then one jar having same package structued classes )
    so that i have loade all the classes using Systems class loader..
    now my need is to find classes whichare present in perticular package structure..
    for Ex. in system class loader it will automatically load java.jang.allclasses;
    what i want is if i knew that package name (java.jang)
    i should find the class name's like Object,String,Long...etc

  • How to find active implementation of badi/

    I have made badi which have two implementation when i access badi , how do i know that which badi implementation will get called....?
    how to find that ,plz let me know..
    Saurin Shah

    Hi,
        Just keep break-point in both of the implementations.
    i.e go to interface and in the method write break-point.
    then when you execute something then the process will first stop at one of the implementation.
    Like that you can find out.
    Reward if helpful.
    Regards,
    Syed

  • How to find out what are the interfaces used for Job and Job Codes

    HI All,
    I just wanted to know how do we find out what are the interfaces used for Job and Job codes .
    Thanks In Advance
    Sunny

    Hi,
    Here is an idea for your request.
    Basically you can create a simple query on multiprovider 0TCT_MC01.
    Filter: you can use a variable for restriction of time ( calday, or calmonth) since you should be interested for a time period.
    Choose following characters into your objects:
    InfoProvider ( 0TCTIFPROV )  - you can create a variable for choosing infoprovider before query runs.
    *Tp.[Type of BI Application Object] 0TCTBISOTYP  = filter this with 'QUERY' or whatever your need is.
    *BI Application Object 0TCTBISBOBJ,  ( this will give you the name of the queries)
    In key figures choose,  Count for BI Appl. (0TCTWTCOUNT).
    (number for query run)
    Create a condition , for top 20.
    Hope this helps.
    Derya

  • How to find classes in ABAP

    Hi experts,
        In java it is easy to find related classes for our requirement based on package and related methods by using API.But how to find that these are the classes are existing for this particular requirement in ABAP.In
    se24 we can find existed classes but can not identified properly for our requirement.
    Can anybody help me in this regard.
    Thanks in Advance.

    Hi,
      As far as I know, SE24/se84 is the place where we can find the information about the global classes available in the system, to find the appropriate class for your requirement, you need to search using the wild card search and go thro' the documentation provided by SAP as SAP has provided a very good documentation(In most of the cases) on classes.
    Rgds,

  • How to find Classes to which characterstics are assigned

    Hi,
    How to find the classes to which a particular characterstics  are assighned in 46B.
    I have characterstics and I should able to find the class/classes to which it is assighned.
    I have a BAPI BAPI_CHARACT_GETWHEREUSEDLIST which does the same as in 5.0 and I want the same FM or BAPI where it is used in 46B.
    Best Regards,
    Mark

    Here's an example of a way to find classes based on characteristics if you need to write your own.  Obviously this is for a report, but you get the idea.
    select-options: s_atnam for cabn-atnam.
    data: begin of t_class occurs 0,
            class like klah-class,
            atnam like cabn-atnam,
          end of t_class.
    select klahclass cabnatnam into table t_class
       from klah inner join ksml
              on klahclint = ksmlclint
                 inner join cabn
              on ksmlimerk = cabnatinn
           where cabn~atnam in s_atnam.

  • How to find classes in the package if package path

    in java i want to find classes,Interface,Exception names which are presant
    in the package..
    for example
    java.sql; if i give this it should return
    class name
    Date
    Time
    DrivarManager
    pls helpme in this field

    download the jdk documentation or view it here
    http://java.sun.com/j2se/1.3/docs/api/index.html
    The exact problem is i hava set the path to my application that path contains several jar's(contains classes,Interfaces) and classes with package structure,
    now my need is if i run the application ,the application
    should find out the classes and Interfaces for given package structure which are present in classpath...
    for this i have to load all the classes to memory(using classes loader) . then find out the classes which are present in memory...
    or
    any other inbuilt method is there in java when i give path structure it find and give classes which are in class path..
    for ex..
    if i set path to jdk
    then if i give the path like java.lang
    it should give me the out put as
    String (or) String.class
    Double
    Cloneable
    (classes & interface in that package)

  • How to find and implement badi's

    hello can any one tell me how to find badi's for a transaction and implement them if any one can show with example will be helpful if any of standard transaction for sd ,
    regards
    afzal

    Hi,
    Just copy and paste this code in editor and execute it.
    Then give your Transaction coe it will displays all user exits Regrading your T.Code.
    *&  Enter the transaction code that you want to search through in order
    *&  to find which Standard SAP User Exits exists.
    *& Tables
    TABLES : tstc,     "SAP Transaction Codes
             tadir,    "Directory of Repository Objects
             modsapt,  "SAP Enhancements - Short Texts
             modact,   "Modifications
             trdir,    "System table TRDIR
             tfdir,    "Function Module
             enlfdir,  "Additional Attributes for Function Modules
             tstct.    "Transaction Code Texts
    *& Variables
    DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
    DATA : field1(30).
    DATA : v_devclass LIKE tadir-devclass.
    *& Selection Screen Parameters
    SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK a01.
    *& Start of main program
    START-OF-SELECTION.
    * Validate Transaction Code
      SELECT SINGLE * FROM tstc
        WHERE tcode EQ p_tcode.
    * Find Repository Objects for transaction code
      IF sy-subrc EQ 0.
        SELECT SINGLE * FROM tadir
           WHERE pgmid    = 'R3TR'
             AND object   = 'PROG'
             AND obj_name = tstc-pgmna.
        MOVE : tadir-devclass TO v_devclass.
        IF sy-subrc NE 0.
          SELECT SINGLE * FROM trdir
             WHERE name = tstc-pgmna.
          IF trdir-subc EQ 'F'.
            SELECT SINGLE * FROM tfdir
              WHERE pname = tstc-pgmna.
            SELECT SINGLE * FROM enlfdir
              WHERE funcname = tfdir-funcname.
            SELECT SINGLE * FROM tadir
              WHERE pgmid    = 'R3TR'
                AND object   = 'FUGR'
                AND obj_name = enlfdir-area.
            MOVE : tadir-devclass TO v_devclass.
          ENDIF.
        ENDIF.
    * Find SAP Modifactions
        SELECT * FROM tadir
          INTO TABLE jtab
          WHERE pgmid    = 'R3TR'
            AND object   = 'SMOD'
            AND devclass = v_devclass.
        SELECT SINGLE * FROM tstct
          WHERE sprsl EQ sy-langu
            AND tcode EQ p_tcode.
        FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
        WRITE:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        SKIP.
        IF NOT jtab[] IS INITIAL.
          WRITE:/(95) sy-uline.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
          WRITE:/1 sy-vline,
          2 'Exit Name',
          21 sy-vline ,
          22 'Description',
          95 sy-vline.
          WRITE:/(95) sy-uline.
          LOOP AT jtab.
            SELECT SINGLE * FROM modsapt
            WHERE sprsl = sy-langu AND
            name = jtab-obj_name.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
            WRITE:/1 sy-vline,
            2 jtab-obj_name HOTSPOT ON,
            21 sy-vline ,
            22 modsapt-modtext,
            95 sy-vline.
          ENDLOOP.
          WRITE:/(95) sy-uline.
          DESCRIBE TABLE jtab.
          SKIP.
          FORMAT COLOR COL_TOTAL INTENSIFIED ON.
          WRITE:/ 'No of Exits:' , sy-tfill.
        ELSE.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
          WRITE:/(95) 'No User Exit exists'.
        ENDIF.
      ELSE.
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        WRITE:/(95) 'Transaction Code Does Not Exist'.
      ENDIF.
    * Take the user to SMOD for the Exit that was selected.
    AT LINE-SELECTION.
      GET CURSOR FIELD field1.
      CHECK field1(4) EQ 'JTAB'.
      SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
      CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    Thanks,
    Reward If Helpful.

  • How to find Badi implementation class & Interface

    Hi Experts,
    I want to get Badi implementation class name and interface name by passing badi implementation name.
    Is there any function module to find out??
    Thanks and regards,
    Venkat.

    Hi Venkat,
    First call the method CL_EXITHANDLER=>GET_INSTANCE by passing the BADI definition name in the EXIT_NAME parameter. Whatever you get back in the INSTANCE parameter --- just pass it through the INSTANCE parameter of CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE method and you will get back implementation class name in the parameter CLASS_NAME.
    For reference on how to use these methods, see the where used list for these methods which are most commonly used in all the standard SAP programs where BADI is called.
    Cheers
    Suresh

  • How can I determine at runtime if a class implements a specified interface?

    subj.

    isAssignableFrom(Class cls)
    Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.

  • How to find classes in a particular package?

    Does anyone know how in Java to find out what classes belong to a particular package? Or to find out what classes inherit from a particular class?
    The reason why I'm asking this is that I want to create a BeanInfo property editor for a widget that will give me a list of any classes in a particular package. I know what that package can be and I know what the main class is that everyone should inherit from. I can easily create a beaninfo property editor with a string array of the classes, but I don't want to have to go back and maintain this code everytime I add another class to that package. I would love to use introspection but I haven't found the right commands to use yet.
    Anyone have any ideas?
    Thanks!

    Not too difficult, the following snippet is used to gather information about a class. beanClass can be parsed to extract package name. and you ask the class directly about its superClasses and implemented Interfaces.
        private Class beanClass = null;
        private Class beanSuperClass = null;
        private Constructor[] constructors = null;
        private Field[] fields = null;
        private Method[] methods = null;
        private Object beanInstance = null;
        public setBeanDetail(Object o) {
            beanInstance = o;
            beanClass = o.getClass();
            beanSuperClass = beanClass.getSuperclass();
            constructors = beanClass.getConstructors();
            fields = beanClass.getDeclaredFields();
            methods = beanClass.getMethods();
        }have loads of fun with it.
    tj...

  • How to find modules implemented and licensed but not used.

    Hi, one of our customer is in such a situation that they have no idea of which are the modules implemented. They have a big list of modules licensed but these are not necessarily be implemented. Is there a query to find out the same or any other option.
    Regards
    Santy

    Hi,
    Hi, one of our customer is in such a situation that they have no idea of which are the modules implemented. They have a big list of modules licensed but these are not necessarily be implemented. Is there a query to find out the same or any other option.Please see (Note: 420648.1 - How to Establish if a Product is Installed in e-Business Suite) and (Note: 443699.1 - How to check if certain Oracle Applications product/module is implemented?).
    Thanks,
    Hussein

  • How to find BAdi implemention name

    Hi Experts,
    In SE18, I am able to find out the BAdi definition name and interfaces and in SE19 I am able to see implementation name and BAdi definition name. The implementation name is customized one. It starts from 'Z*'. But having only BAdi def. name and interface name how can I find out customized implementations. Is there any table which maintains it?
    Thanks and regards,
    Venkat.

    Dear Venkat
    in  se18
    give the def name and then menu -> enhancement implementation->display
    u can see all implementations for this badi
    hope u r clear
    regards
    Sajid

  • How to find out local or home interface  was used ?

    Hi !
    are there any ways in the code of methods ejbCreate and ejbRemove in my entity EJB to find out were they called via local or home interface provided that my bean has both local or home interfaces ?
    Thenks in advance.

    Why should you care, this logic should only be implemented in the client (SEJB or Servlet). Even then it should only be used to check if there is a LocalHomeInterface. If not you get the RemoteHomeInterface. I don't understand the question completely.

Maybe you are looking for

  • The Application Adobe Illustrator CS2 quit unexpectedly

    Hi, I have a room of networked Mac's (G4) OS 10.4.6 and we have had all twenty machines running CS2 and everything working fine. Now that the machines haven't been used for a while I can only get 7 of the machines to work on CS2. I get this error mes

  • File Error everything I try and render?

    Just recently everytime I render, it never 100% completes it stops at about 94% and just comes up with File Error I/0?  Which is quite frustrating?  Any body else had this problem?  I have double checked that I am rendering all and it is set to do th

  • How can we store an image in the file the image is int he form of bytes

    hi How can we write an image to a file and save it to hardisk the i mage is in the form of bytes please if any body knows please send the code for it Thanks for u reply

  • OIM API: Caching OIMClient

    We have a webapp that connects to OIM using a separate OIMClient for each user of the web app. For example, when user1 logs into the webapp they're logged into OIM via an OIMClient, when user2 logs in, a new OIMClient is created for them.  In this wa

  • Explanation for the code

    class ThreadA { public static void main(String [] args) { ThreadB b = new ThreadB(); b.start(); synchronized(b) { try { System.out.println("Waiting for b to complete..."); b.wait(); } catch (InterruptedException e) {} System.out.println("Total is: "