Lookup the name of class where a methode is called from?

Hi
i have an object A and an object B. From A i call a methode in B and within that methode i need to find out ot which type the object is that called the methode.
Is there any methode to find out which object is calling the methode and to find out of which class type that object is (resulting in a String containing the name of that class)?
Thanks for your help.

I can think of two ways to do this. First, you could get the current StackTrace and parse it up. You'd be looking for the stack trace element immediately before the current method is called if I understand your post correctly. If you are using JDK 1.3.1 or below, you'd have to print the StackTrace to a String. If you are using JDK 1.4, there is a new Object called StackTraceElement. You can get an array of them from an Exception object.
Second, you could use AspectJ to crosscut code into your application. AspectJ is complicated so I will just point you to their website for more information: http://www.aspectj.org.
Dave.

Similar Messages

  • Know the name of class caller...

    Hi... it has a way to know the name of class caller... that is the class name than use a methodA of a ClassA and in the methodA know the name of class than is using this method...

    Hi... it has a way to know the name of class caller...
    that is the class name than use a methodA of a ClassA
    and in the methodA know the name of class than is
    using this method...
    And the requisite question - why?

  • Object synchronization method was called from an unsynchronized block of co

    I have installed DotNETWebControlConsumer_3.0_sp1
    in my machine I am very much new to Plumtree
    I am building the application in vs 2005 or .Net 2.0 environment and plumtree 6.0
    here is my web.config file code
    <httpModules>
    <add type="Com.Plumtree.Remote.Loader.TransformerProxy, Plumtree.WCLoader, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0e882dd51ca12c5" name="PTWCFilterHttpModule"/>
    </httpModules>
    and I get the error Object synchronization method was called from an unsynchronized block of code
    I just removed the html format for posting purpose i mean all the less than and greater than sign
    please I need it so badly

    Regarding your first issue (because it looks as if you removed the <httpModules> node from your web.config to move on from that issue), I changed 'Aqualogic.WCLoader' to 'Plumtree.WCLoader' in <httpModules ../>, added a reference to Plumtree.WCLoader in my project , then added another <add assembly="Plumtree.WCLoaderyadayada...> accordingly to the <assemblies> node in the web.config and then it worked. Well, almost, now I'm seeing a new error:
    [NullReferenceException: Object reference not set to an instance of an object.]
    Com.Plumtree.Remote.Transformer.PTTransformer.HandleRequest(HttpContext ctx) in e:\buildroot\Release\wcfilter\3.0.x\filter\src\Com\Plumtree\Remote\Transformer\PTTransformer.cs:60
    Com.Plumtree.Remote.Transformer.PTTransformer.BeginRequestHandler(Object sender, EventArgs e) in e:\buildroot\Release\wcfilter\3.0.x\filter\src\Com\Plumtree\Remote\Transformer\PTTransformer.cs:54
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
    Mine is a .net 2.0 portlet that will work if I don't try to use the WCC 3.0SP1 (by pulling the <httpModules> node. But then I'm guaranteed no inline refresh. I have no fix yet, but when I do, I'll post it. I've contacted Plumtree Support in the meantime because others must be having the same problem.
    p.s. Also using edk 5.3 signed, though I'm going to upgrade to 5.4 and see if that does anything.

  • How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk

    How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk.i did try all the options but I can not find the phone number to call from Croatia,
    I can not change my Apple ID to the old mail (not possible!)
    The old mail don't accept the new password..
    I can not delete the Icloud all the time asking my the password of the old mail!
    I realy need help

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • What's the best way to transfer (not forward) a call from one iPhone to another?

    What's the best way to transfer (not forward) a call from one iPhone to another? Is there an app available that does this? I'm asking about receiving a call, then transferring that caller to another iPhone on a separate number and then disconnecting while those two users are joined up in a conversation.

    Ask your carrier. This would be a feature provided by them.

  • Can you increase the size of the photo that shows when you receive a call from a contact

    Can you increase the size of the photo that shows when you receive a call from a contact ?

    It used to be if you added the contacts photo on the iOS device they would have a large picture and if you added it from Address Book on OS X they would have a smaller thumbnail.  However, since iOS5, all I've been able to get is the larger photo.  Try adding the picture directly in the contacts app on your device.  That should make it larger.

  • Is there any method which reflects the names of classes of java?

    is there any method with which dynamically we can get all the packages's name along with their classes of java(specially core classes of java)?if not how can we do that?

    The resource from which the Java VM loads the classes is considered to be implementation dependent. It may be class files or jar files contained in a file system hierarchy, or some kind of remote database. The now defunct Microsoft VM used a database repository that was able to reside on a remote class server within a network domain.
    Unfortunately, Sun did not design a class resource service interface with a "list resources" function, only a "get resource" function. You can get the class resource for any named class, but you cannot list packages or classes within a package or at the root level.
    This is further complicated by the fact that there is no such thing as an "installed package" as Java does not define any package installation system. The packages available to any runtime instance of the JVM is defined by the classpath properties passed from the OS. Different JVM instances can have completely different sets of available packages because they were passed different classpath values by the OS.
    If you know the class resource of the runtime environment, then you could create a subclass of the sun.misc.URLClassPath class and add to it methods that will list packages and classes found within a package using the interface of that known class resource.
    Most runtime environments use a standard hierarchical file system to hold jar and class files. A subclass of sun.misc.URLClassPath could use the java.io.File class to traverse the file system classpath paths in search of package directories and class files (Watch out for recursive directory links).
    The root packages can be obtained from the three levels of classpath paths in the System properties used by the JVM:     "sun.boot.class.path"
         "java.ext.dirs"
         "java.class.path"The collection of file system paths obtained from these properties would be searched for the names of the root level package directory names. Just remember that this will only work in a runtime environment that only uses this kind of class resource. If you run this where some other resource is also used, you will not see all of the packages available to that JVM.
    One note of caution: A single directory can hold package directories, jar files, and class files that belong to a specific package, but the package may include other package directories, jar files, and class files that are contained in other directories. Pieces of a single package may be strewn throughout the file system. The only way to find them all is to scan all of the classpath paths for that same package name. The directory does not define the package, it only provides more content for that package.
    I hope you find this of some use.

  • To change the string in Class Builder "New Method"

    HI friends,
    Im using the std program of "RFDOPR10"...(changed into my customised program as ZRFDOPR10).....
    Here i want to change the strings of Id_type eq 4 availble under the class builder "New Method".
    "id_ruler_string = '2.13.24.29|43|58|73|88|103|118|'" (for 24...i want to give 38.....then 45...)
    Pls help me how to change the std method function  for my z program...
    FYR:
    RFDOPR10 is the std program for tcode :"s_alr_87012178", Customer analysis.If u want to c the example report, in this tcode...give OI:1, Summ level:6, OI list:1 and Company CD:2 under Output control tab in selection screen with Company code.Now, u able to see the reports in the screen.There, after Customer number....I've to give some more spaces(length) for Sort field.
    Thanks & regards
    Sankar.

    No, but I suggest using a different editor which does allow a different text option and just pasting it in.

  • Can't find registered ActiveX class - where's LabVIEW getting this from...?

    Hi All
    I'm trying to found out from where LabVIEW is getting this particular class from, since it isn't showing up when I open the Active X class browser, and yet somehow seems to be magically registered - I have some invoke nodes and it works fine. Why doesn't it show up in the class browser - shouldn't everything? Where else can I look for it? It's not a standard LV class, but a third party exe I installed. I know the class name (right clicking invoke, browse...). Ideas?? 

    If you have a typelibrary you should probably use the regtlib.exe program instead. Some useful information might be found in this article. Of course if your library comes with an installer, the installer should have done this.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do i change the name of my phone in i tunes - inherited from my husband

    I've inherited my husband's old phone and am on a sim only contract -I have set upmy apple id but when i synch tunes it shows the phone as my husbands ( albeit my number ) - how do i change the name of the phone ? - thanks

    In iTunes, just click on the name on the sidebar or in the info panel and edit it.  Or, on the iPhone itself,
    Settings -> General -> About -> Name

  • Determining which method to call from an array of Objects

    Hi All,
    Lets suppose I have an interface, a string method name, and an array of Objects indicating the parameters which should be passed to the method.
    What Im trying to work out is a way to quickly determine which method should be invoked.
    I can see that Class has getDeclaredMethod(String, Class[]), but that wont help me as I dont know the formal class types (the method may take X, but I might get passed Y which extends X in the array of objects).
    Does anyone know of a quick way I can determine this?
    All I can think of at the moment is going thru each method of the class one by one, and seeing if the arg is assignable, then, after getting all my matched methods, determining if there are any more 'specific' matches.
    Any ideas?
    Much appreciated,
    Dave

    you might want to take a look at the dynamic proxy apiCheers for the suggestion, but Im actually already using the dynamic proxy API.
    What I have is a MockObjectValidator which allows mock objects to be configuered with expected calls, exceptions to throw etc etc.
    I thought developers on my project would get tired using an interface like this:
    myValidator.setExpectedCall("someMethod", new Class[] { typeA, typeB }, new Object[] { valueA, valueB} );
    I.e, I wanted to cut out having to pass the class array, so they could just use:
    myValidator.setExpectedCall("someMethod", new Object[] { valueA, valueB} );
    The problem there is that I then need to pick the best Method from the class given the object arguments.
    When the mock object is in use, its no problem as the InvocationHandler interface provides the Method. The problem I have is selecting what method a user is talking about from an array of Objects.
    Ive written a simple one now, it just does primitive type class -> wrapper substitution, and then finds ** A ** match. If there is more than one match (ie, all params are assignable to a class' method params), I dont let that method be used.
    Shortly I'll update it to actually make the correct selection in those cases.
    cheers
    Dave

  • Conn Method Access - Calling from method

    Hi I am trying to create a method in another class to call another method that checks for userid in DB? What is the best way to set this up? I.e. calling method?
    //calling method below line
    private boolean setuserExist(String username) {
         else return false;
    public String getserExist() {
              return userexist;
    // Method being called below this line
    public boolean userExist(String username){
              boolean exist = false;
              System.out.println("in LoginDBAccess: username is " + username);
              try{
    Connection conn = dbc.getConnection();
    Statement statement = conn.createStatement();
    String query =      "SELECT User.UserID " +
                        "FROM User " +
                        "WHERE User.UserID = '" + username + "'";
    ResultSet resultSet = statement.executeQuery(query);
    System.out.println("1.1");
    ArrayList result = new ArrayList();
    while(resultSet.next()){
         //System.out.println("In While:");
    ArrayList item = new ArrayList();
    item.add(resultSet.getString("UserID"));
    result.add(item);
    System.out.println("LoginDBAccess Count: " + result.size());
    conn.close();
    if (result.size() == 1){
         exist = true;
              }catch(Exception e){
         e.printStackTrace();
              return exist;
         }

    http://forum.java.sun.com/thread.jspa?threadID=603496
    Cross-post.

  • Click on download of pdf opens adobe acrobat reader, but then clicking on file save-as does not give a dialog box to change the name or location where it is sav

    Using Firefox 19.02
    When I receive an email with an Excel, Word, or PDF file attachment, and I click download, firefox opens up the associated program for all my users, however when you click on file>save-as you are not presented with the dialog box to perform a save.
    Excel and Word, no fix at all. Other than different browser or to click download, right click and go to folder, and then copy it out of there to another folder and open it.
    Help, what is going on here????
    Gordon rutherford

    BTW: using Adobe Acrobat Reader XI

  • How do I get VI name and path where mouse is programati​cally from another VI

    Hi, this is my first question here.
    I am trying to create a permanent running, ObtainInfo.vi, in LV 7.1 that automatically gets ínfo from other running VI:s. I would like to obtain info from the other VI:s when the mouse is being clicked over there. Information could be the other VI:s name and/or reference. I have tried different methods without any results.
    Solved!
    Go to Solution.

    I gave it a try myself. The screenshot is attached. The problems unsolved are some errors I get when I used all VIs, the execution state property is the workaround for this. You certainly also want to have it for VIs that are Running (not top-level).
    Felix 
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    Attachments:
    MouseDown.PNG ‏43 KB

  • How can I change the name of my icloud acct in sending pictures from from iPhoto

    how can I change my info like my username, ID, password in sending  out iphoto emails? I have iCloud but in tryong to change there doesn't seem to do the job,
    KenMan

    No, you cannot change the original email address you created on setup.  However, you can create an alias using the nickname - see http://support.apple.com/kb/ph2622

Maybe you are looking for

  • Problem sending mail since downloading update

    I cannot send email from my IPad since downloading update. I can receive but not send. Is there a fix?

  • Since updating to iOS 6, I cannot access any of my purchased movies in the cloud

    on any of my devices (ipad 3, ipad 2, iPhone 4S or iPhone 4) but I can access them via Apple TV.  I have hundreds of purchased movies, so its not rescinded rights by the networks/studios.  I have restarted the devices. I've deleted settings.  I hones

  • "Save For Web" buttons change, favorite locations

    Adobe, Why did you move the Save, Cancel and Done buttons to the bottom of the Save For Web dialog box? In CS3 (which I just upgraded from) they were right above the file format/quality selectors, which was perfect for choosing a format and quickly c

  • FW 3.0 Photo app not functioning properly

    Has anyone elso noted that the 3.0 Photo app is broken? The orientation can no longer be changed. So now landscape photos viewed while holding the iPod in the landscape orientation are displayed on their side. There does not seem anyway to flip the p

  • 2GB limits on SQL*PLUS output file

    Hi, We are running 64bits Oracle 8.1.7.4 and SQL*PLUS 8.1.7.0 on 64 bit SunOS. There is no limit on file size on the unix login and I am able to work with file over 2GB. However, I am not able the output over 2GB to text file from SQL*PLUS. The SQL*P