How to get CLASS name for the generic item?

Hi,
I wrote following method to create a service instance.
public static <IType> IType GetServiceInstance()
       IType type=null;
        try
        InitialContext ic=new InitialContext();
//ERROR:      type=   ic.lookup(IType.class.getName());
        catch(Exception ex)
        //do handle
        return type;
    }please see the //Error: here its giving error, also i m not getting "class" variable in IDE!!!
i want use like this;
IUserService userService=ServiceFactory.GetServiceInstance<IUserService>();so how can i do this?
Edited by: Manikandan.Java on Oct 31, 2007 3:02 AM

I don't know if I understand your question, but you cannot find the class name because it is in run time just an object. You can, however, check if it is an instanceof.
if (genericType instanceof MyType) {
     doMyThing();
}

Similar Messages

  • 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 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 to get Open Balance for the year and Total Ending Balance?

    For a given account, how to get Open Balance for the year (Cumulative Ending Balance) and Total Ending Balance (Cumulative Ending Balance)?
    Is there any function module available? or should I read from some tables? Please advice.

    Hello Paul,
    You could try calling one of the following BAPIs - see which one meets your requirement. They are documented well so shouldn't be a problem finding out the correct one for your requirements.
    BAPI_GL_GETGLACCBALANCE      
    BAPI_GL_GETGLACCCURRENTBALANCE
    BAPI_GL_ACC_GETBALANCE      
    BAPI_GL_ACC_GETCURRENTBALANCE
    BAPI_GL_ACC_GETPERIODBALANCES
    BAPI_COND_VAL_DECRE_BALANCES
    You might have to put in some of your own logic after the BAPI call to get what you want.
    Hope this helps,
    Cheers,
    Sougata.
    p.s. Also look at FM FAGL_GET_ACCOUNT_BALANCE
    Edited by: Sougata Chatterjee on May 7, 2008 11:47 AM

  • Any Function module or BAPIs are available to get scheme name for the inter

    I have internal order no value in table  AUFK-AUFNR ,  and the internal order corresponding Scheme value is available in IMPR-PRNAM . Now I want to inner join both the tables to extract the data , but there is no common field . Is there any Function module or BAPIs are available to get scheme name for the internal orders?

    look at DB-VIEW  "V_IVP_OR".
    Regards,
    Laurent

  • How to get class name of a object in run time, from its accessible context.

    Hi,
    I need to get the class name of a java object in run-time, given the AccessibleContext of that object.
    I gone through the AccessibleContext api documentation. but there is not way to get the class name for a java object using its AccessibleContext object.
    Do any one have any idea how to get the class name of an java object, given its accessible object Accessible.
    Thanks
    Timberlake

    816311 wrote:
    Please try to provide a solution for my requirement and avoid evaluating a requirement.
    I am a curious guyit's great to be curious. however, in this situation, the requirement makes no sense in the given context. so, in an effort to be helpful, the people on this forum are asking you the reason behind the requirement. the reason we do this is because we have experience answering questions on this forum and, more often than not, requirements which don't make sense are the result of misunderstandings or confusion on the part of the person making the requirement. if we can figure out why you want to do what you want to do, we may be able to point you in a direction which makes more sense.

  • How To Get Attribute Names for a Particular VO

    Hi ,
    How To Get Attribute Names Of a Vo where I can Set Viewattributname To the Table RN Columns Where I am Adding Extra Columns Based on Some Condn..
    So wen i am creating new Column to existing Table RN and we Need to add Attribute Name Also...Rt..
    And How To get RelationShip Between Database Column Name and Java Vo Attribute Name
    Ex: PlanId is the Java VO Attribute Name for the Database Column PLAN_ID
    In The Same way Hw We Get the Relation ship for All other columns In the Controller Cllass ..
    Can Any One Reply as It is urgent Req...
    Thanks ,,
    Jithen

    Instead of using the VO attribute names to set and get values, best to go to the VO definition, click on Java, and generate the View Row Class with the accessors.
    In the class where you're trying to set attributes, instead of a Row class, use the View Row class of your VO (eg ViewObjectName's class would be ViewObjectNameRowImpl), and when retrieving a row from the VO, cast the row to the previously mentioned View Row Class.
    At that point you can use the View Row Class's methods that would perform sets and gets of each column.
    To get attribute names, I don't know off the top of my head, but there might be a method mentioned in the Javadoc for the ViewRowImpl or ViewObject or ViewObjectDefinition classes to get the attribute/column mapping, or perhaps you can somehow read the XML definition of the VO which has that mapping.
    Assuming business components were built automatically and no attribute names were overridden, intuitively the attribute name is a camelcase version of the column name, removing understores and capitalizing the character following the removed underscore - but that's not a fool proof approach. Just a general observation.
    Hope this helps.
    Edited by: user6631964 on Sep 16, 2010 12:31 PM

  • How to get class name and method name within a class method?

    Hi,
    In a java class, is it possible to get its class name and the class method?
    Please advise.
    Thank you.

    I mean whether there's any built-in command that will
    return the class name instead of code it ourself, for
    easier maintenance.
    Possible?
    this.getClass().getName();

  • How to find table name for the fields from Standard Extractor in CRM system

    How to find table name of fields from the standard extractor in CRM system ?
    e.g. We use LBWE TCode in R/3 system to find table name for the field from Extractor VCSCL(e.g.).
    Likewise is there any way to find table name for the fields from Standard extractor like 0CRM_LEAD_I.

    Hi ,
    Please find the link below for understanding BW CRM analysis.
    http://help.sap.com/bp_biv135/html/bw.htm
    activate the CRM DSs by scenario:
    1) Activate the application component hierarchy (tcode RSA9). Changes made to the application component hierarchy in the CRM system can be transferred to the BW using the "Edit Application Component Hierarchy" (SBIW - Postprocessing of DataSources).
    SAP Note 434886 must be implemented in CRM 3.0 before the application component hierarchy is activated.
    2) Activate the Business Content DataSources (tcode RSA5).
    Select/enter the application component and choose Execute (F8).
    To compare the shipped and active versions, choose the 'Select Delta' pushbutton. If there is no active version of the DataSource, it is selected automatically.
    To activate the shipped version, choose the 'Transfer DataSources' pushbutton.
    3) Management of the versions of the BW-Adapter metadata (tcode BWA5). All DataSources are displayed that are managed by the BW Adapter.
    As in transaction RSA5 (Service API Metadata Activation), the 'Select Delta' function can be used to select the inactive DataSources or compare shipped and active versions.
    You can also go directly to the screen for maintaining DataSources that are managed by the BW Adapter.
    The 'Compare Version' function makes a detailed comparison of the shipped and active versions.
    All BW-Adapter metadata is considered when versions are compared:
    Header information (Table SMOXHEAD)
    Mapping information (Table SMOXRELP)
    Global selection conditions (Table SMOXGSEL)
    Attribute key fields (Table SMOXAFLD)
    Hope this helps.
    Regards,
    csm reddy

  • How to specify file names for the generated code in wscompile

    Hi,
    We want to follow a certain file naming conventions for the artifacts generated by wscompile.
    How is it possible to set the name for the service interface file, service implementation file etc....
    This is possible in AXIS ant task Wsdl2Java. How do we do it for wscompile.
    thanx

    Thanks Chris and c. Under Description I'm presented with three Names for the profile: ASCII, UniCode and Mac Script. ASCII and Mac Script are the same name for the profile, with nothing being in the UniCode Name box. Which do I change -- both?
    Am I going to screw things up in Photoshop if I change these names to something I can comprehend? Looks like I may just have to make a sticky-note list of the cryptic profile names with my own descriptive name as a reference. Thanks.

  • Table names and field names for the PO item details

    Hi,
    I want table names and field name for the below fields.
    I have PO number i want to get below fields for PO.
    <b>Confirmed Ship Date (or actual ship date if already shipped) – PGI Date
    Quantity of Product to be shipped (base unit of measure) Sales Order Qty
    Shipped Quantity of Product (normally zero)
    Shipped From Plant Name</b>
    Excellent reward is compulsary.
    reagrds,
    vijay

    Hi,
    Please find below the some of tables and fields for the PO. But from your query hope you are refering some other PO.
    Table : EKPO
    Fields
    KTMNG - Target Qty
    MENGE - Open Qty
    WEPOS - Goods Receipt
    LEWED - Latest GR date
    Table : EORD
    Fields
    RESWK - Procurement plant
    FRESW - Fixed Issuing plant
    LIFNR - Vendor
    FLIFN - Fixed vendor
    Regards,
    BK

  • How to execute separate code for the first item inside forloop?

    Hi All,
    I would like to execute "foreach (SPListItem item in items)". Here, for the first item i want to execute separate code and all other items should execute another code. How to achieve this?

    Basic .NET question... not really a SharePoint question...
    Option one, create a counter:
    int myCounter = 0;
    foreach (SPListItem item in items)
    if (myCounter == 0)
    else
    myCounter++;
    Option 2 - use a for loop
    for (int i = 0; i < items.count; i++)
    SPListItem item = items[i];
    if i == 0)
    else
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • 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 retreive logical name for the OLAP source system

    dear all, i am writing an extractor for a data source and need to fetch the OLAP SOURCE SYSTEM (r3 backend) for it.
    obviously in RSA1, you can see the source system of the data source, however, i have debugged this and could not find the function or class that puts the source system in the field.
    in short i have the data source, and i know i want it to be the active version, so how can i get the olap source system of this ?
    thanks
    glen
    Edited by: gingle on Dec 2, 2008 10:22 PM

    Try tcode SM59.  I am locked out of the transaction at this client, so I can't give you any more details.
    You can also look at the source system in RSA1 ... go to the source systems tab and change it.
    Both of these steps are typically basis steps, so i would advise you to be cautious when doing anything in either of those screens.
    Brian

  • 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.

Maybe you are looking for

  • Mixing Memory Mac Pro 2.66 Xenon

    Hello all! Alright I am trying to figure the best configuration that I can afford for a memory upgrade to my Mac Pro. I am looking to spend somewhere south of $200. I currently have the following memory configuration (3GB): DIMM Riser A/DIMM 1: 1 GB

  • IOS 8.1 How to batch delete unfavorable photos?

    since iOS 8, we lost the iPhoto app and the ability to batch manage photos. As sad as that is, now I'm ready to move on. With the new photo app, i see that we can mark a photo as favorite but I cannot see which photo is favorite on the grid view so I

  • Problems with import utility.

    Hello friends, I'm having very basic problems during a import process, I have to import a database from a .dmp file exported from someone else's system to my system. I don´t know the Oracle version that export was generated, but my Oracle version is

  • Getting ORA-06512: at "APPS.FND_MSG_PUB", line 279 error in Oracle Sourcing

    Hi, We have recently applied Sourcing Rollup 2 J patch in our instance. After this, when the users change their timezone, the system behaves weirdly. The Server timezone and Client timezone are set to Dubai timezone (GMT+4) at site level. If the user

  • Relative date as selection option

    Hi Experts, could any of You pls help me to define a relative date as selection options? I have a program about production order selection with a start date as selection option (AKFO-GSTRP). I would like to run this program daily as a background job