How to get reference name in the class

i have a doubt in java.
class x
public String toString()
// code here i want
class y
p s v main(.....)
x servlets=new x();
x jsp=new x();
s.o.p(servlets);
s.o.p(jsp);
the result i want is :
hai servlets
hai jsp
what code to be in toString().

You can't get hold of the variable name at runtime. If you want that output, you'll need to create it like this:
x servlets=new x("servlets");so that the x.toString() can know which string to print out.
Message was edited by:
johannef

Similar Messages

  • How to get Resource Name in the Repository Service when Publish evt trigger

    Hi ,
    I have created a repository service in which I have registered the
    StatemanagementEvent.PUBLISH
    My requirement is I need to know which resource rather resource name triggered this event.
    This is the code which
    public class ApprovProcs extends AbstractRepositoryService implements IReconfigurable, IResourceEventReceiver
      private static final String TYPE = "ApprovProcs";
      private Collection repositoryManagers;
      public ApprovProcs()
        super();
        // Do not add code here. Add it to startUpImpl() instead
      public String getServiceType()
        return ApprovProcs.TYPE;
      protected void startUpImpl(Collection repositoryManagers) throws ConfigurationException, StartupException
        // implement this method as follows:
        // - Verify configuration data
        // - Get references to other needed (global) services
        // - Check whether other repository services (this service depends on) are also assigned to the repository managers
        // - Usually the service registers itself for certain events at all repository managers
                 this.repositoryManagers = repositoryManagers;
              Iterator it = repositoryManagers.iterator();
              while (it.hasNext())
                   try
                        addRepositoryAssignment( (IRepositoryManager) it.next());
                   catch (ServiceNotAvailableException e)
                        e.printStackTrace();
      protected void shutDownImpl()
         Iterator it = repositoryManagers.iterator();
         while (it.hasNext())
              try
                   removeRepositoryAssignment( (IRepositoryManager) it.next());
              catch (WcmException e)
                   e.printStackTrace();
      protected void addRepositoryAssignment(IRepositoryManager mgr) throws ServiceNotAvailableException
        // Implement this method: Usually the service registers itself for certain events at the repository manager.
         try
              // capture all the respurce which are published
              mgr.getEventBroker().register( this, new StatemanagementEvent( StatemanagementEvent.PUBLISH, null ));
         catch(WcmException e)
      protected void removeRepositoryAssignment(IRepositoryManager mgr) throws WcmException
        // Implement this method: Usually the service must unregister itself as an event handler.
         //mgr.getEventBroker().unregister(this, new ResourceEvent(ResourceEvent.CREATE_COLLECTION, null));
         mgr.getEventBroker().unregister( this, new StatemanagementEvent( StatemanagementEvent.PUBLISH, null  ));
      public void reconfigure(IConfiguration config) throws ConfigurationException
        this.stateHandler.preReconfigure();
        // check the new configuration data
        try {
        catch (ConfigurationException ex) {
          this.stateHandler.postReconfigure(ex);
          throw ex;
        this.config = config;
        this.stateHandler.postReconfigure();
      public void received(IEvent event)
         System.err.println( "----rid --42354543--- " );
           IResource rsrPublished  = (IResource)event.getParameter();
           if( rsrPublished != null )
              System.err.println( "----rid --42354543--- rsrPublished.getDescription() --- " + rsrPublished.getDescription() );
           else
              System.err.println( "Resource Does not exist -----" ) ;
    In the log file I am getting Null Pointer Exception
    Can any one please help me in this as where I am going wrong
    thanks
    pk

    Hi Romano & Detlev ,
    Thanks for the reply .
    This is what I was looking
    Detlev:
    About the NPE ... in the above code I am not getting that.
    Thats my mistake
    Earlier I tried with
    IResource rsrPublished  = (IResource)event.getParameter();
    String rid = rsrPublished.getRID().toString();
    In the second line of code I was getting the NPE
    after that I used to if condition to debug it
    Sorry for the confusion...
    One more thing
    which is the event triggered for approval or how to capture the Approval Event when a content is approved by the Approver
    thanks
    pk

  • How to get file name on the base of extension

    hi
    reply me
    how to get the filename on the base of extension from the
    current directory......
    for example
    i create file with the "igg" extension and save in the folder
    where the exe file of director save....
    i want when exe run then exe file read filename of the
    define( "igg" ) extension with out path just name of the file with
    igg extension
    tel me how
    regards
    farhana khan

    Here's a solution that requires no xtras:
    on GetFilesWithExtension(aFolderPath, aExtension)
    -- INPUT: <aFolderPath> should be a valid string
    folder path
    -- <aExtension> may be a string file extension,
    without the
    -- dot. For example: "txt" or "igg"
    -- OUTPUT: Returns an error symbol or a linear list of file
    names
    -- in the given folder. If an extension is given, only
    -- files with the given extension will be listed. If not,
    -- all files and folders will be listed.
    vFileList = []
    if not stringP(aFolderPath) then
    return #stringPathExpected
    end if
    vIgnoreExtension = not stringP(aExtension)
    vDelimiter = the itemDelimiter
    the itemDelimiter = "."
    n = 0
    repeat while TRUE
    n = n + 1
    vFileName = getNthFileNameInFolder(aFolderPath, n)
    if vFileName = "" then
    exit repeat
    end if
    if vIgnoreExtension then
    vFileList.append(vFileName)
    else if the last item of vFileName = aExtension then
    vFileList.append(vFileName)
    end if
    end repeat
    the itemDelimiter = vDelimiter
    return vFileList
    end GetFilesWithExtension
    You can also use
    Buddy API's baFileList,
    which allows you to do wildcard searching.

  • How to get file name of the form attachment?

    Hi,
    is there anybody who is able to help me with the following problem???
    I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.
    I need to get file name of attached file in the process!!!
    I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:
    Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?
    Thanks for your suggestions.

    Hi LekomDev,
    I faced the same situation some time back and this is what I know.
    Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)
    The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.
    So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.
    But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.
    Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.
    hope this helps,
    cheers,
    Parth Pandya
    Blog: http://livecyclekarma.wordpress.com

  • How to get domain name for the userId?

    There is a generic way to get userID
    System.getProperty( "user.name" ).
    In case of windows it's a name you login in.
    Is any way in Java to figure out domain name of that particular user by Java code?
    Igor

    You can dojava.net.InetAddress.getLocalHost().getHostName()to get the name of the computer. But this will not give you the "domain name of the user". In Windows, for example, when I sign on to my computer, that user name only means something to my computer. There's no "domain", in the Internet sense, involved.

  • How to get event 'out of the class'

    I have been reading myself silly about this, I either don't get it or it is very difficult.
    What I want to do:
    1) setup
    2) show panel
    3) handle input in panel
    4) once valid
    5) "get out"
    6) display other panel.
    I can go all the way to 4.
    But I can't get "out" of the panel.
    All I can guess/understand is that I have to trigger an event that will be handled below/outside this panel.
    Has anybody some idea how to do this? Maybe a link to some example code?
    There is tons to read about event handling but the (only) part I understand is about events within classes just as all the examples are (One panel two buttons, two pictures etc)
    I guess the only option I might envision is dividing by zero and catching the error outside the panel.
    That would be bazooking a mosquito, but it also shows what I try to implement.
    I'd be so happy to understand this part of the 'java system' ...
    (please understand that I don't want 'cardlayout', I want to understand what I need to do)
    Much thanks for any help!

    Thank you for your suggestion.
    My problem is that I am (feel?) stuck within the panel.
    So to put it differently, I cannot build a child panel with a button (in the child) that will have the parent pane change color. This as my 'code focus' is within the child panel and I cannot 'activate' code outside it.
    I am totally confused now as to how java works.
    So I cannot write a parent pane with a child pane where the child tests for a name and if the name is correct the child will be removed and some code will put in another child pane with fi a picture.
    This seems so utterly basic to any programmers needs, but I cannot find one example - or I have gone blind looking for it. In my code if I want to read the input field I have to handle it within the child pane, if I want to change child panels I need to do that in the parents panel code. But I can't change the code focus. So the child needs to generate an event that the parents can act upon, but there are no examples while I actually expect tons of examples. So maybe I don't speak 'Java'.
    This meaning that I cannot write a stack of panes and remove them one by one using fi the escape key.
    I am just left clueless by Java.

  • How to get my Name in the From Field instead of email address?

    For an Exchange Activesync account, how do you get your friendly "Name" to show in the From: field rather than email address ([email protected])?
    I seem to be able to do this fro IMAP/POP accounts but not Exchange Activesync.
    All the discussions I've found about gmail and Activesync seem to be centered on getting your messages to show a different return email address than your exchange account. I'm not looking for this, just to show the Name.
    Thanks

    If you add a contact ("Contacts app>> "+">> enter info) with that email address, it will appear in mail with whatever name you set in the email address' contact.

  • How to get a name of the current marker?

    I have two director files with same identical marker names (2
    language versions). How I can make a button that changes the
    language (goes to the same marker of the other file). Something
    like... go to "current marker name here" of movie
    "language_2".

    ok, now the really cool method. You can get any marker name
    whether it's
    above the current frame or not.
    mkrName = (the markerList)[(marker (0)).string]
    will give you the marker above the current frame or the first
    marker to the
    left of the current frame if there is no marker above the
    current frame.
    Similarly,
    mkrName = (the markerList)[(marker (1)).string]
    will give you the first marker to the right of the current
    frame whether
    there is a marker above the current frame or not. You can see
    how you can
    get the name of any marker just by changing the parameter of
    the marker ()
    function.
    If you're worried that the first example doesn't tell you
    whether the marker
    is above or behind the current frame a simple test will do.
    if marker (0) = the frame then
    -- this is true when the marker is on the current frame
    end if
    Craig Wollman
    Word of Mouth Productions
    phone 212 928 9581
    fax 212 928 9582
    159-00 Riverside Drive West #5H-70
    NY, NY 10032
    www.wordofmouthpros.com
    "temes" <[email protected]> wrote in message
    news:e4hate$ods$[email protected]..
    >I have two director files with same identical marker
    names (2 language
    > versions). How I can make a button that changes the
    language (goes to the
    > same
    > marker of the other file). Something like... go to
    "current marker name
    > here"
    > of movie "language_2".
    >

  • How to get host name in the workflow?

    Hi,
       I've a requirement where I need to get CQ Inbox url (http://<hostname>:<port>/inbox) in my custom workflow process. I thought of configuring url to some node and retriving from there.. but It's not the good approach as host name will be different for differnt CQ environments. So what is the best way of getting inbox url?
    Env: CQ 5.6
    Thanks
    Siva

    Yep Justin, If the configuration is wrong, any link generated would also be wrong.. I mean, default configuration will be some thing like..
    I mean, I can change those configurations as per my instance host name, right?
    Example: my instance's host url is:  mytest:1501
    So I would like to update the same in configurations ..

  • How to get functionID/Name of the current page

    Hi guys,
    I have two EBS standard forms "Supplier Entry" and "Supplier View Only" defined as two separate functions in the menu. Depending on which function was launched by the user I have to do some extension.
    I found that following code can be used to know whether function is available in the menu or not. But the problem occurs in situation where both functions are available to the user and since the logic fail.
    FunctionSecurity funcSecurity = pageContext.getFunctionSecurity();
    boolean isFunc1 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME1"));
    I need to know specifically which function was used to launch the form.
    On the following post https://forums.oracle.com/message/10468620#10468620 Parag tell something like this
    ( "IMC_NG_ORG_CONTACTS".equals(pageContext.getParameter("ImcLandingFunction"))
    but I don't know what  "ImcLandingFunction" equates to in my scenario. I don't see AOL functions passing any parameters to forms.
    or is there any other method to know?
    Can anyone help?

    did you try these ones ? :
       pageContext.getFormSubmitName();
       pageContext.getFunctionId();

  • How to get the name of the class which is currently in use

    Hi all,
    I have two classes Mother and Child, and I use this code to print the name of the class in use
      DATA m TYPE REF TO zmother.
      DATA class_name type string VALUE 'CHILD'.
      CREATE OBJECT m TYPE (class_name).
      CALL METHOD m->PrintName .
    So, what is the source code that I have to put in the PrintName methode?
    Thanks.

    Ok, but how can I get the name of the object class that calls the methode!
    REPORT  ztest_method.
    *       CLASS c1 DEFINITION
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS: get_data.
    ENDCLASS.                    "c1 DEFINITION
    *       CLASS c1 IMPLEMENTATION
    CLASS c1 IMPLEMENTATION.
      METHOD get_data.
    ****** What is the code to put here to know the name of this Class?*
      ENDMETHOD.                    "get_data
    ENDCLASS.                    "c1 IMPLEMENTATION
    DATA oref TYPE REF TO object.
    DATA: method TYPE string.
    DATA: cla_name(20).
    START-OF-SELECTION.
      cla_name = 'C1'.
      CREATE OBJECT oref TYPE (cla_name).
      BREAK-POINT.
      CALL METHOD oref->(method).

  • How get controls name from a class private data?

    How can i get the names of the controls inside a class private data?
    I am using Actor Framework and trying to create a method tha will be executed when launch the actor. This method need a list o all the control names inside the class data to search for the initial value inside a configuration file (config.ini), the key on the configuration file will be the name of the control.
    Thanks.
    Solved!
    Go to Solution.

    You are already making the overriding method just because you have to write to the Bundle By Name.  And then how are you going to handle all of the data types the keys could be.  You are making things more difficult than it should be for really very little benefit.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to get maximal value from the data/class for show in Map legend

    I make WAD report that using Map Web Item.
    I devide to four (4) classes for legend (Generate_Breaks).
    I want to change default value for the class by javascript and for this,
    I need to get maximal value from the class.
    How to get maximal value from the data/class.
    please give me solution for my problem.
    Many Thx
    Eddy Utomo

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • How to get column names for a specific view in the scheme?

    how to get column names for a specific view in the scheme?
    TIA
    Don't have DD on the wall anymore....

    or this?
    SQL> select text from ALL_VIEWS
      2  where VIEW_NAME
      3  ='EMP_VIEW';
    TEXT
    SELECT empno,ename FROM EMP
    WHERE empno=10

  • How can i get my name on the finder bar?

    How do i get my name on the top right corner next to the search bar? I have OS X Mountain Lion 10.8.5

    System Preferences > Users & Groups
    Click the lock to unlock it, if you have to.
    Click "Login Options".
    Enable " Show fast user switching menu as" and select "Full Name".
    Best.

Maybe you are looking for

  • Footer in smartforms.

    Dear friends!     I need your help. I am strugling with strenge problem in smartform. I am supposed to print item numbers in the footer of the data_table in main window. I can print some of the item numbers form the internal table,  I have 2140 item

  • If I buy a Mac and iPad online, will I still be able to claim warranty at an Apple Authorized Service Provider?

    If I buy a Mac and iPad online, will I still be able to claim warranty at an Apple Authorized Service Provider? I am going to buy a Macbook Pro w/ Retina Display and iPad from www.topbuy.com.au . It's a legit website, but they say the items have topb

  • How do I transfer my itunes music library to my new computer

    How do I transfer my itunes music library to my new computer (not a mac owner)?

  • Figures numbering issue

    Hello, I want to number figures' captions in a single document in the most simple sequence (Fig 1, Fig 2, Fig 3...). I have created a list and a paragraph style for figures' captions. In the paragraph style I have set Fig ^# as the numbering option.

  • Still battling Premier Element installation.

    I have a download from March--will not install. I have a download from June--will not install. I have the CD--will not install. I keep getting a message to uninstall and reinstall, error message:1 Quicktime no longer works. I downloaded the Adobe Dow