Retrieving dynamic information from generic type

Hi,
I am aware that the dynamic information can be asked for via Object's getClass(). For instance,
List<? extends Number> list = new ArrayList<Integer>;
System.out.println(list.getClass());
This would return `ArrayList' as an "actual" or "static" type for `list' object. I was wondering whether there is a way to retrieve dynamic type information from the Field object. For example, if we have the following class:
public class MyClass [
public List<? extends Number> someList = new ArrayList<Long>;
and retrieve its instance field:
Field field = MyClass.class.getField("someList");
Is it possible to ask for its dynamic type, which is ArrayList after erasure, just as I mentioned in my first example?
Thank you

Thank you Stefan, that does the trick. Initially, I had read the API incorrectly as to what argument get() takes. Now my problem is, how do I replace the type parameter of a generic class with a type argument that I only know at the runtime having only an object of Class<?> c. That is to say,
class MyClass<T> {
  public T someClass;
  public MyClass(T t) {
    this.someClass = t;
  public T getT() { return this.someClass; }
  public static void myMethod(Class<?> c) {
    MyClass<c> mc = new MyClass<c>(c.newInstance());
  private void someOtherMethod() { // access getT() }
}I know `new MyClass<c>()' is illegal, but is there a way I can create an instance of MyClass having only Class<?> c? Or is this even possible? If not, what are the work arounds?
Thank you

Similar Messages

  • How to retrieve CRL information from a client computer

    Is possible to retrieve CRL information from a client computer and how?
    Thanks.

    CRL's do not normally live on workstations... normally these are hosted on servers. If you want to see what server are in the local revocation list then look at the certificates mmc snap-in and look at the revoked certificate list. If you want to test
    a CRL for a certificate then export the certificate and run "Certutil -url"
    Alan Burchill (MVP)
    http://www.grouppolicy.biz
    @alanburchill

  • Conflict Resolver Sync Error - Unable to retrieve conflict information from the sync server

    So I have been using iTunes with my iPhone 3GS and now my iPhone 4 to sync with my Outlook for many years now  and it has been flawless.
    I recently bought a new iPad and started syncing it as well.
    Now as of late, after every 2 or 3 syncs, I get an error from iTunes displaying the Conflict Resolver and it says there are 42 sync conflicts.
    When I try use the Review Now button it shows up and the issues are between my iPhone and Outlook and are only related to contacts.
    As soon as I try to choose which record to resolve, the window immediately disappears without giving me a chance to finish and I get another dialog window with the error:
    Unable to retrieve conflict information from the sync server.
    Please try again the next time the conflict resolver window is presented.
    When I try to sync again it seems to be fine.  But then after I sync my iPad and theny iPhone again it shows up and it still won't let me resolve the conflicts.
    I have tried the following:
    1) Rest Sync History on all devices
    2) I have had iTunes replace all the contacts on the iPad from iTunes
    3) I have changed the conflict resolver to only notify when 50% of the data will be changed
    I have had no such luck.
    If I add a contact to Outlook or to my iPhone and then sync it seems to be syncing the new addtions correctly.  However, I cannot get this issue with this 42 conflicts resolved for some reason.  This has been going on for a month now.

    Here is the solution. 
    Rationale: You want to be able to have the dates on your items (notes, contacts) on your iphone to be the same as on outlook.  This will eliminate any sync conflicts.  You will also notice that if you modify something on the iphone and sync, you will lose the modification you made.
    Steps:
    1) In outlook, export the data (contacts, notes) to a CSV file
    2) Delete you notes/contacts in outlook
    3) Sync your iphone and select replace information on this iPhone (in iTunes)
    4) Now your contacts and notes will be empty on both your iPhone and Outlook
    5) Now import your contacts and notes from the CSV files back into outlook.  What this does is put the current date and time on every individual item
    6) Sync your iPhone to iTunes normally
    7) everything will work correctly now with no sync issues and no conflicts.
    Sherali

  • Want to retrieve Account information from Siebel on demand thru web service

    Hi
    i have trial account on 'Siebel on demand' and want to retrieve the information from account or any object. There is one method mentioned in the 'OnDemWebSvcs.pdf' file as 'ContactQueryPage' ,but how to used this method is not clear.
    So can any body give any pointer on this?
    Thanks
    Yash

    Hi,
    Thanks for immd reply and it is really useful for new user like me.
    I converted the wsdl file to java. Now suppose i want to fetch all the record from User object on SOD, i wrote the following code snippet but got error as Internal Error: Session is not available. Aborting Server.
    Code : In java
    private static String mstrUrl="https://secure-ausomxega.crmondemand.com/Services/Integration";
    URL wsUrl = new URL(mstrUrl);
    Default_BindingStub defaultBindingStubObject=new Default_BindingStub(wsUrl,null);
    UserLocator []listOfUser=new UserLocator[1];
    UserLocator userLocatorObject=new UserLocator();
    //String xml ="<ListOfUser><User><FirstName /><UserLastName /><LastUpdated> (>='07/28/2004 06:30:00') AND (<='07/28/2009 06:45:00')</LastUpdated></User></ListOfUser>"
    UserWS_UserQueryPage_Input("1","1",listOfUser1,"1");
    UserWS_UserQueryPage_Input userWS_UserQueryPage_InputObject=new UserWS_UserQueryPage_Input("1","1",listOfUser,"1");
    UserWS_UserQueryPage_Output userWS_UserQueryPage_OutputObject = defaultBindingStubObject.userQueryPage(userWS_UserQueryPage_InputObject);
    Can any body provide any pointer on this, how to make a query in Siebel On Demand.
    Thanks
    Yash

  • Hello.  I just upgraded to Lion OS X 10.7.3.  I was previously running 10.5.7 which included the ENTOURAGE application.  how do I retrieve needed information from this application that no longer runs on this new system?

    Hello.  I just upgraded to Lion OS X 10.7.3.  I was previously running 10.5.7 which included the ENTOURAGE application.  how do I retrieve needed information from this application that no longer runs on this new system?

    The file you'll be looking for that has most of what you're looking for - messages, address book, etc. is the Entourage Database.  The verison of Microsoft Office I run (on Lion) is Office 2008.  By default the Entourage Database for this verison is at user/Documents/Microsoft User Data/Office 2008 Identities/Main Identity/Database.  That folder (Main Identitty) also has your rules, signatures, and such.  You'll have to recover this file from whatever backup you have.  If you have a different version of Entourage, the file location will be a little diffferent.
    Good luck
    srb

  • Cannot access conflicts unable to retrieve contact information from the sync server.

    ITunes error message Cannot access conflicts unable to retrieve contact information from the sync server.

    I got this advice from Gator5000e on Apple Supposrt Communities:
    I use Windows 7 so the path to find this file
    might be different under a different OS.
    Close iTunes. Search on the words "conflicts.synconflicts".
    I renamed it  to conflictsold.synconflicts the .synconflicts is the extension so you can't
    rename that.
    Then restarted Windows. As a test I made changes to a note in NOTES on each device. Then connected them one at a time to my computer which has iTunes 10 and Runs Windows 7, it worked !

  • HT1414 I forgot to backup my phone before I did this. Is there any way to retrieve my information from my phone before I restore it and lose everything?

    I forgot to backup my phone before I did this. Is there any way to retrieve my information from my phone before I restore it and lose everything?

    I didn't restore the phone yet, I just updated and It says it's now in recovery mode, and that I need to restore it. Is there anything I can do to save anything?

  • Retrieving content information from mulitpart message

    I am trying to retrive the contents of the mulitpart message using the below code snippet
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         Multipart multi = (Multipart)p.getContent();
         BodyPart bp = multi.getBodyPart(1);
         bp.writeTo((OutputStream)os);
         String output = os.toString();
         System.out.println(output);
    I get the following output(This is delivery notification mail)
    Content-Type: message/delivery-status
    Content-Transfer-Encoding: 7bit
    Final-Recipient: RFC822; [email protected]
    Action: failed
    Status: 5.1.1
    X-Supplementary-Info:
    X-Display-Name: [email protected]
    I want to retrieve some specific information from the above content
    i.e , I need only the final recipient mail id from the above message
    How could I achieve it ??
    Could nebody help me in this regard??

    Does your question have anything to do with the (6 year old) topic in this thread?
    I'm not sure exactly what your problem is. JavaMail provides methods to get the
    recipient information, but it's definitely the case that such information does not
    have to be included in a message. If it's not there, there's nothing JavaMail can
    do to get it for you.

  • Retrieve all values from project type when project type combo box is null

    Hi,
    We are facing a tight situation here. We have a scenario where we have 2 filter options.
    1) Department ID
    2) Project type
    When department ID is selected all the department IDs should be populated in the combo box and the project type combo box should be empty.
    Similarly, when project type is selected all the project types should be populated in the combo box and the department ID combo box should be empty.
    Then, when more than one value is selected from department ID box and all the values from project type must be retrieved from query level (as per business logic).
    How do we do this? Kindly help us with this situation.

    Basically my situation slightly different.
    I am trying to do a bulk insert on SQL Server table using prepared statement, during that time i am getting the exception. I am using JDBC-ODBC driver. However, if i do individual record insertion, it is working.
    Any idea about this type of problem ?
    Regards
    Ramesh

  • How do I retrieve permission information from WLS7.0

    Hi all,
    I'm using JAAS to secure a Swing client's access to EJB's in WLS. I'm using
    JAAS to authenticate the client and that works great.
    Now I want to retrieve information from the server about permissions that
    the logged in client has on the server, and wich actions is allowed on
    EJB's.
    I'm trying something like:
    EJBPermission perm = new EJBPermission("some action");
    AccessController.checkPermission(perm);
    Is that at all possible in J2EE security architecture? Is there a Weblogic
    specific API to use when checking for and retrieving permissions from WLS?
    thanks in advance
    Jesper Svak

    "Jesper Svak" <[email protected]> wrote in message
    news:[email protected]..
    \> Is that at all possible in J2EE security architecture? Is there a
    Weblogic
    specific API to use when checking for and retrieving permissions from WLS?
    I don't think this is possible.

  • Can I retrieve partial information from time capsule?

    I have a new hard drive I want to install that already has some files on it that I want to keep.  When I tap into time capsule can I retrieve selected information?  I don't wnat to lose the files on the new hard drive but need to restore my computer information from the old hard drive.  Thanks in advance...

    It is a bit hard to follow what you are attempting..
    Is the new hard drive going to be a boot drive.. if so it needs wiping.. if not then you should be able to restore info to it.. as long as it already has the right format.
    http://pondini.org/TM/15.html
    But you will need to give a lot more info for us to understand..
    Hard disks are cheap btw.. buy more.. do not mess with files you want to keep.. as you are just as likely to wipe them in the process of doing what you want. Just get another drive. And another.. it is like there is a never ending requirement for hard disks.
    If there is any info you ever think is important.. NEVER NEVER have it on only one hard disk.. you are one second from complete disaster.

  • Syncing my phone it says I have conflicts when then I get the message "Unable to retrieve conflict information from the sync server.  Please try again next treset Sync history and hasn't helped.

    When syncing my phone it says I have contact conflicts which I try to resolve and then I get the message "Unable to retrieve conflict informaiton from the sync server.  Please try again next time the conflict resolver window is presented".  I have reset the Sync History but hasn't helped.  Suggestions?

    Here is the solution. 
    Rationale: You want to be able to have the dates on your items (notes, contacts) on your iphone to be the same as on outlook.  This will eliminate any sync conflicts.  You will also notice that if you modify something on the iphone and sync, you will lose the modification you made.
    Steps:
    1) In outlook, export the data (contacts, notes) to a CSV file
    2) Delete you notes/contacts in outlook
    3) Sync your iphone and select replace information on this iPhone (in iTunes)
    4) Now your contacts and notes will be empty on both your iPhone and Outlook
    5) Now import your contacts and notes from the CSV files back into outlook.  What this does is put the current date and time on every individual item
    6) Sync your iPhone to iTunes normally
    7) everything will work correctly now with no sync issues and no conflicts.
    Sherali

  • Error: unable to retrieve column information from the data source

    Hi,
    I am trying to set up a data flow task. The source is "SQL Command" which is
    a stored procedure. The proc has a few temp tables that it outputs the final
    resultset from. When I hit preview in the ole db source editor, I see the
    right output. When I select the "Columns" tab on the right, the "Available
    External Column List" is empty. Why don't the column names appear? What is
    the work around to get the column mappings to work b/w source and
    destination in this scenario.
    In DTS previously, you could "fool" the package by first compiling the
    stored procedure with hardcoded column names and dummy values, creating and
    saving the package and finally changing the procedure back to the actual
    output. As long as the columns remained the same, all would work.
    Thats not working for me in SSIS.
    Thanks in advance.
    Asim.

    I had a similar problem retrieving column information when calling a stored procedure which returned a table declared as a variable within the procedure. I used "Command SQL" as data access within the OLE DB Source Editor, and "exec <sproc_name> <param_list>" as text for the SQL command.
    After a few trials and errors, I noticed when I removed the IF statement that validated the parameter passed to the sproc it worked, i.e. SSIS could retrieve the column information, otherwise it wouldn't.  Is it because of the IF, the BEGIN/END, or the RETURN? I do not know as I did not test further, but by removing the entire instruction block pasted below, it worked. Hope that it helps.
        if @Reel_Ou_Budgete not in ('B', 'R')
        begin
            print 'Le paramètre de cette procédure stockée doit être B ou R.'
            return -1
        end

  • Retrieval of information from a textfile

    i have a little problem here. how do i retrieve information from a textfile?

    there are many ways you can do this - paulcw just gave me a great resource that will help you learn how to do it:
    java.sun.com/j2se/1.4.2/docs/guide/resources/index.html
    however if you are relatively beginner, the methods described there may be intimidating or hard to use for you. I happen to have an "EasyReader" class that simplifies reading from a textfile greatly, (note that it will not work for applets due to security reasons though). If you find the resources guide to difficult, email me and I will send you a copy of the EasyReader class.

  • Retrieving query information from a SYS_REFCURSOR using XMLSEQUENCE

    G'day.
    I am trying to retrieve the colum name from the first column selected in a query. I have no idea what the column name is, however I was pointed in the direction of the following code snippet to help me retrieve the name:
    DECLARE
         v_rc_sv               SYS_REFCURSOR;
         v_query               VARCHAR2(4000);
         v_value_col_name     VARCHAR2(4000) := NULL;
         v_updated_query          VARCHAR2(4000);
    BEGIN
         v_query := 'SELECT val FROM a_table';
         OPEN v_rc_sv FOR v_query;
         FOR gen_cursor IN (
              SELECT     ROWNUM rn,
                   t2.COLUMN_VALUE.getRootElement () NAME,
                   EXTRACTVALUE (t2.COLUMN_VALUE, 'node()') VALUE
              FROM     TABLE (XMLSEQUENCE (v_rc_sv)) t,
                   TABLE (XMLSEQUENCE (EXTRACT (COLUMN_VALUE, '/ROW/node()'))) t2)
         LOOP
              IF v_value_col_name IS NULL THEN
                   v_value_col_name := gen_cursor.NAME;
                   EXIT;
              END IF;
         END LOOP;
         CLOSE v_rc_sv;
         -- Now we have the column name, we can construct a query string which
         -- wraps the original query with a standard select statement that includes the column
         -- name.
         v_updated_query := 'SELECT ' || v_value_col_name || ' FROM (' || v_query || ')';
    EXCEPTION
         WHEN OTHERS THEN
              RAISE;
    END;From the last line, you can see I use the name of the column to wrap the query string, so that eventually I can use the updated query to retrieve the value from the query.
    My question is, can I also use the same method (by using XMLSEQUENCE) to tell me how many columns have been selected in the unknown string ? Also can it tell me if the unknown query has put an alias on any of the select columns (and what they might be) or the query is using the original column name ? ie: select name from person_table VS select name the_name from person_table (where the_name is the column alias) ?
    Edited by: Greg Block on May 27, 2010 5:59 PM
    Apologies for the formatting, I had typed it nicely :)
    Edited by: Greg Block on May 27, 2010 8:55 PM
    Updated with the formatting tag, thanks for the tip

    Hi,
    If you're using 11g, you can take a look at UTL_XML.PARSEQUERY.
    Here's an example with your requirement, it'll output the number of colums and their names (and aliases) :
    DECLARE
      tmplob clob;
      parsed_qry xmltype;
      num_of_cols number;
    BEGIN
      dbms_lob.createtemporary(tmplob, true);
      utl_xml.parsequery(
        user,
        q'{SELECT employee_id as emp_id, last_name FROM hr.employees WHERE job_id = 'IT_PROG'}',
        tmplob
      --dbms_output.put_line(tmplob);
      parsed_qry := xmltype(tmplob);
      select count(*) into num_of_cols from xmltable('//SELECT_LIST_ITEM' passing parsed_qry);
      dbms_output.put_line ('Number of column(s) : ' || to_char(num_of_cols));
      for r in (
        select *
        from xmltable('//SELECT_LIST_ITEM'
                      passing parsed_qry
                      columns colnum for ordinality,
                              colname varchar2(30) path 'COLUMN_REF/COLUMN',
                              colalias varchar2(30) path 'COLUMN_ALIAS' default '<no alias>')
      loop
        dbms_output.put_line('Column '||to_char(r.colnum) || ' : ' || r.colname ||', alias = '||r.colalias);
      end loop;
      dbms_lob.freetemporary (tmplob);
    END;
    Apologies for the formatting, I had typed it nicelyI'm sure you did but the forum doesn't render it unless you enclose your code with tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • DBA:CHECKDB__ is getting failed

    Hi All, One of the job in SM37 is getting cancelled. DBA:CHECKDB__ 8.04.2009 11:00:00 Job started 8.04.2009 11:00:00 Step 001 started (program RSDBAJOB, variant &0000000000189, user ID ECCDBA) 8.04.2009 11:00:00 No application server found on databas

  • Intel iMac fan problem?

    my fan seems to be running all the time, is this normal? Its like a humming noise, i mean i can hear it but i'm just not sure if I'm suppose to be hearing it and if its suppose to be on all the time when my computer is awake. can any users comment pl

  • Newline character in report heading

    Hi all, I have an application that displays some testing information in a classic report. I have two groups for failed test, Major and Minor. I would like to have the column heading display like:   Major        Minor   Fails         Fails How would I

  • Need info about tool"/OpenSPARCT2_Arch/hypervisor/src/hypervisor-tools/bin"

    Hi, I am looking in to the source code of the hypervisor, I am looking for information on various tools used in the source code, which are located in "hypervisor/src/hypervisor-tools/bin" -rwxr-xr-x 1 durgam 25078 2284760 Nov 15 01:35 as -rwxr-xr-x 1

  • How to "Rotate & fill" in CS5?

    Hi! I recieves E-mails from Adobe on regulary basis with tips&tricks how to use different functions in Photoshop CS5. It's the "Russel Brown Show" and in one episode he shows something I could have great use to. It's about "Content Aware Fill". Now a