GetClass() and int

Hi all, I'm sure this is a stupid question but I wanna check anyway.
I'm trying to make a "nice" implementation of the Class getColumnClass(int col) method of an AbstractTableModel, and have a question:
In the following examples ii would be a member of a class representing the structure of a row in the database table. This code works as I expect:
Integer ii = new Integer(0);
return ii.getClass();This code doesn't compile:
int ii = 0;
return ii.getClass();Did I miss something here? "int" isn't an "Object"?

Hi guys,
Thanks for the replies.
I had been wondering about the difference betweem int.class and Integer.TYPE... I ended up going with the .class versions.
My original thought was that since I have already declared an instance variable, I should just be able to query the variable to get it's class for the table model to use. However, I was foiled in two regards...
1. I was using primitive datatypes, which don't have a .class member or getClass() method.
2. It seems that you can only query the class for an instantiated variable. I had wanted to do this from a static function because at the time of initializing the table model, I hadn't actually populated the row cache.
In the case of 1. above, perhaps I can use Integer instead of int, but I don't know if there are any other issues or problems associated with this. I want to use the row structure members as bind variables in SQL statements (as opposed to concatenating string values to make a fresh SQL statement each time). I have no idea if it works, have to try it I guess.
In the case of 2. it may be that a different syntax would solve the problem, if anyone has any suggestions, please let me know.
In the meantime, my function looks like this:
public static Class getColumnClass(int tableCol) {
switch (tableCol) {
case 0: return Integer.class;
case 1: return Integer.class;
case 2: return String.class;
case 3: return String.class;
case 4: return Double.class;
case 5: return Integer.class;
case 6: return Integer.class;
case 7: return Integer.class;
case 8: return Date.class;
Workable, but none too sophisticated.

Similar Messages

  • IBM WPS: Error While Creating App and Int Server Connections in JDev 10g

    Hi,
    I have been struggling to create App Server and Int Server connections in JDeveloper 10.1.3.4 without any luck.
    The JDeveloper is present on VM ware machine from which I'm trying to establish the connections to remote server where SOA Suite 10g is installed on IBM Websphere.
    My Settings:
    App Server:
    Connection Type: Standalone OC4J 10.1.3
    RMI: tried WC_defaulthost port, 6003, RMI default port (How do I get the actual value of RMI on IBM Websphere and does this really make a difference?)
    Connection test fails with Mbean error. Ignored this error as documented in Installation guide.
    Int Server:
    Used the above App Server connection, gave the http port value of 9700 (also the WC_defaulthost on IBM Websphere)
    Connection test fails for App Server, BPEL PM Server and ESB Server.
    I have gone through other threads where different workarounds were suggested but none of them worked for me. The workaround of adding the property ipaddr with the value 0.0.0.0 in opmn.xml doesn't hold good here as IBM WPS doesn't have OPMN.
    Please suggest a working solution for this issue.
    Regards,
    CC

    The below message comes when you don't specify any default file for your webcenter portal application and this should not be any problem.
    Target Portal.jpr is not runnable, using default target index.html.
    Can you answer to my questions:
    1. Did you just created a new wcp application in jdev and ran it with out doing any changes? If you have done what are the changes?
    2. How did you ran your application? (right clicking a particular page or right clicking your portal project and selected "run" option?

  • Problem Logging it to Int Rep and Int Dir of SAP XI

    Hi,
             I m using SAP XI 3.0, I am maintaing 2 systems, one as server and one as client. In the client system I have installed J2e engine and SAP GUI. I have problem logging in to Integration rep and Int Dir in the Client system. I have no logging problem in SERVER, but I have in Client system.
      So pls help me in this regard....
    !!!THANKS IN ADVANCE!!
    Sunil Shetty

    Hi,
               If its a problem in the exchange profile, then how is it possible to log in to the SAP XI Server, which is having the same use name and password.
    User Name and Pass Word of Server System is Same as the Client system.I can log in to the server but I am unable to log in to client system which is another system.
    Thanks in advance.
    Sunil Shetty

  • How to read a C structure with string and int with a java server using sock

    I ve made a C agent returning some information and I want to get them with my java server. I ve settled communication with connected socket but I m only able to read strings.
    I want to know how can I read strings and int with the same stream because they are sent at the same time:
    C pgm sent structure :
    char* chaine1;
    char* chaine2;
    int nb1;
    int nb2;
    I want to read this with my java stream I know readline methode to get the first two string but after two readline how should I do to get the two int values ?
    Any idea would be a good help...
    thanks.
    Nicolas (France)

    Does the server sent the ints in little endian or big endian format?
    The class java.io.DataInputStream (with the method readInt()) can be used to read ints as binary from the stream - see if you can use it.

  • Megacom not working for both LD and Int'l

    I got the same issue described here https://supportforums.cisco.com/message/311063#311063 but only differences are my setup is using CCM 4.2 and Cisco 3845's.
    To make a LD call to work, I got to set the "Called party IE number type" under the GW config to National; and
    To make an Int'l call to work, I got to set this value to International.
    If I leave everything default, i.e. Cisco CallManager, only LD works.
    Basically, I couldn't make both LD and Int'l to work. It's either one way or the other.
    Any workaround to make both to work would be greatly appreciated.
    Thanks,
    Kevin

    Both device has automatic download on.

  • Passing floating point values, but being recognised as doubles and int's?

    Hi,
    I was wondering how to differentiate between floating point values and ints etc
    I am passing values into a public class with the parameters (float... values)
    Public Example (float... values){}new Example (1, 1e2, 3.0, 4.754);
    It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.
    How come?
    Cheers

    chokpa wrote:
    Public Example (float... values){}
    new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
    new Example (1f, 1e2f, 3.0f, 4.754f);

  • Operator + cannot be applied to operands of type 'method group and 'int'

    Hello I have a problem that I'm trying to fire a bullet everytime I pressed the spacebar key, but I have this problem that is cropping up.
     if ((e.KeyCode == Keys.Space) && (playerOne.Bullet.Alive == false))
                                playerOne.Bullet.Alive = true;
                                playerOne.Bullet.getX = playerOne.getXposition + 15;
                                playerOne.Bullet.getY = playerOne.getYposition + 10;
    It says in the error list: "Opeartor '+' cannot be applied to operands of type 'method group' and 'int'", I have no clue. I'm also new to programming.

    I want to get the bullet to shoot where the player is, here is the code:
    class Player
            // attributes here  -   Int other words data types and variables:
            int health = 3;
            float xPosition;
            float yPosition;
            Bitmap playerGraphics;
            int score = 0;
            bool leftPressed;
            bool rightPressed;
            float Width = 50;
            public Bullet Bullet = new Bullet();
            // functions here:
            public void Init()
                // Get Player_Bat.png from resources, so that we can work with it:
                playerGraphics = new Bitmap(Green_Aliens.Properties.Resources.Player_Bat);
                health = 3;
                score = 0;
                xPosition = 375;
                yPosition = 540;
                leftPressed = false;
                rightPressed = false;
                Bullet Bullet = new Bullet();
            public float getWidth()
                return Width;
            public void toggleLeftPressed()
                if (leftPressed == true)
                    leftPressed = false;
                else
                    leftPressed = true;
            public void toggleRightPressed()
                if (rightPressed == true)
                    rightPressed = false;
                else
                    rightPressed = true;
            public bool getLeftPressed()
                return leftPressed;
            public bool getRightpressed()
                return rightPressed;
            public Bitmap getGraphics()
                return playerGraphics;
            public float getXposition()
                return xPosition;
            public float getYposition()
                return yPosition;
            public int getHealth()
                return health;
            public int getScore()
                return score;
            public void moveLeft()
                xPosition -= 10;
            public void moveRight()
                xPosition += 10;
            public void loseLife()
                health--;
            public void adScore(int valueAdd)
                score += valueAdd;
            //Resets the player to the start position:
            public void resetPosition()
                xPosition = 400;
                yPosition = 550;

  • How I get random number between 1 and int number ?

    how can I get random number between 1 and int number
    like between 1 and 10 etc.
    10x

    Use the nextFloat() method of the Random class, this returns a random number between 0.0 and 1.0. To get and integer range from that multiply the return value of that method call by the integer range you need (in this case 10), and add the starting number you want returned in the range (1 in this case). The code below works for numbers 1-10.
    Random r = new Random();
    int x = (int)(r.nextFloat()*10) +1;

  • Differnce between byte[] reading and int[] reading

    While reading information from file using fileInputStream ....
    Is there any differnce between byte[] reading and int[] reading ?

    Well, in as much as you can do the former and not the latter.
    FileInputStream just reads blocks of bytes. If you want to read more sophisticated element you need to wrap in in a DataInputStream or a Reader.

  • Date from a string and int value in ssis

    hi so my table is as follows
    active      expirymonth     
    expiryyear
    0              October                         2014
    0              February                            2015
    1               January                        2012
    and so on
    now my requirement is that if active =0 then in a new table lets say LASTDATE and they want a date with the last day of the expiry month and year  and if active is anything else write NULL for eg
    LASTDATE
    10/31/2014
    02/28/2015
    NULL
    I went to derived tables and made a new table called lastdate. What expression do i build in the expression builder to get the required result as i could not find a way to convert the text into int and then into a date

    Hi Bharatb111,
    If you want to achieve this using Derived Columns transform, you have to use following expression to first convert the month name value to integer:
    ([expirymonth]==”January”)?1:([expirymonth]==“February”)?2: ([expirymonth]==”March”)?3:([expirymonth]==“April”)?4:5
    However, if we need to validate a couple of or even all of twelve months, the expression validation will be failed. So, the Derived Column approach is impossible.
    To achieve your goal, you can use a Script Component to perform the date format conversion. This way, we can convert “dd/MMMM/yyyy(such as “01/October/2014”) format string value to “MM/dd/yyyy” (such as “10/01/2014”), and assign this value to a new output
    column (assuming its name is “DateVal” and its data type is DT_DATE) of the Script Component. Then, we can drag a Derived Column under the Script Component and connect them. In the Derived Column, we can add a new column named “LASTDATE” with the following
    expression:
    ([active]==0)?DATEADD(“d”,-1, DATEADD(“Month”),1,DateVal]):NULL(DT_DATE)
    For the Script Component code snippet, please refer to Reza’s answer:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1661339c-252c-4197-9cfd-943e1d86b573/convert-a-string-to-date-format?forum=sqlintegrationservices 
    Hope this helps.
    Regards,
    Mike Yin
    TechNet Community Support

  • Name and int using a String

    Hi everybody,
    ive got a class that creates a new int. i want the name of the int to be a parameter that i can send into the class. so for example:
    public testObject(String intName)
    then in my main I could say:
    testObject grader = new testObject(gradeOne);
    and the testObject class would make a new int called gradeOne.
    does anybody know how i could accomplish this?

    Well you can hava a java.util.Map that maps Strings (for the names) to Integers (for the values).
    You could encapsulate that map within another class if you feel that helps the design, and provide a method that expresses the relationship pretty easily, e.g.,:
    public class NamedInts {
      private Map mapping = new HashMap();
      public void addNumber(String name, int value) {
        mapping.put(name, Integer.valueOf(value));
      // other methods, presumably, as well
    }Is that what you meant?

  • String to Int and Int to String

    How can I convert a string to Int & and an Int to String ?
    Say I've
    String abc="234"
    and I want the "int" value of "abc", how do I do it ?
    Pl. help.

    String.valueOf(int) takes an int and returns a string.
    Integer.parseInt(str) takes a string, returns an int.
    For all the others long, double, hex etc. RTFM :)

  • How do I ensure OSX finds both Ext HD and Int HD on boot?

    I have OSX 10.5.1 on both an Internal HD and External HD.
    I prefer to use the External HD but sometimes it will startup on the Internal HD of its own accord.
    I've tried going in Startup Disk and selecting External HD and then locking the padlock but the padlock doesn't stay locked, it's always undone the next time I go back into Startup Disk.
    It seems it's failing to recognize the External HD on boot sometimes, because if I boot from ALT, then sometimes the Ext HD does not show up on the blue screen where it should - and from there I should be able to choose between the Ext HD and the Int HD - but when it's not there, I can't.
    But if I then shut down, then disconnect and reconnect the Ext HD, then most times the Ext HD WILL appear on the blue screen when I boot from ALT and I then can choose it and that's fine.
    But how do I fix it so both the Ext HD and the Int HD are found by the OS every time, like it used to?
    This has only started recently, like in the last 2 days, after working fine for several months.
    Thanks if you can help.

    Hello anna
    This can happen on my eMac running Panther, where the external fails to be immediately recognized sometimes. The system log reports a failed login or somesuch from memory. However, within a few moments it will appear. Usually opening a new Finder window will jog it to re poll for any external connections and then find it.
    In your situation that delay will lose that opportunity for it to be available as a startup drive.
    Once started and it is not showing, opening Disk Utility can often bring an external disk in to play, not that this solves your problem, just quicker than rebooting.
    Whilst an eMac has no second hard drive bay, it is possible to sacrifice the optical drive and install a second internal drive in that compartment, thus having two physical hard drives on your Desktop. As I say, that sacrifice is losing your DVD drive, but you can attach it as an external drive if you don't use it much. This is a bit of a workaround but maybe something to mull over.
    Tech note: access to the DVD is straight forward on an eMac (for an eMac). Access to its hard drive is so difficult it is not worth attempting.
    So maybe a hardware solution of sorts, for what is I think possible a hardware problem with eMacs.

  • Crystal Reports Grand Totals and int not working

    I am new to Crystal Reports, I am using the Visual Studios version. I have a couple of different questions. My report is a cross tabs report. In one of the cells I want to include a name and the total number of records for the person. To make it visually appear how I want it, I have chosen the Cross-Tab Group Options - Use a Formula. This is what I have entered:
    {SP_GET_QATPADJ.AJNAME} + ChrW(13) + ToText(Int({SP_GET_QATPADJ.CNT})) + " Claims", the problem is the .CNT field still shows the .00 after the number. I want it to be a whole number. I have tried several different functions in place of the Int, but it still shows the .00.
    My second question, is there any way to modify just one grand total? Within each person of the report there are three rows, number correct, number possible and percent (all of these are returned in the stored procedure). The total column on the right totals the correct & possible okay, but for the percent I would like it to be the percent of the total correct & total possible. LIke the total correct is 13 and total possible is 20, I would like the percent to be 65 (it is showing 234 the sum of the percents for all the columns).

    Inorder to remove .00 for an integer try this
    ToText(Int({SP_GET_QATPADJ.CNT}),"##")
    For the other question
    Right click on Total Correct value and go to format field and write the suppress condition by clicking on X+2 corresponds to suppress like this
    whileprintingrecords;
    numbervar TC:=currentfieldvalue;
    false;
    Now again Right click on Total Possible value and go to format field and write the suppress condition by clicking on X+2 corresponds to suppress like this
    whileprintingrecords;
    numbervar TP:=currentfieldvalue;
    false;
    Now right click on percent value and go to format field and click on X+2 corresponding to DisplayString
    and write the formula like this
    whileprintingrecords;
    numbervar TC;
    numbervar TP;
    totext((TC/TP)*100)+"%"
    Hope this would deffinetly help you!!!!
    Raghavendra.G

  • Question about java reflection and "int" type

    hi, using reflections I should invoke a Method (meth3) that have as parameter an INT type (not integer). I've tryed with this code:
                        int num = 3;
                        Class[] vettClax = {int.class};
                        Object[] vettParam = {num};
                        Method meth3 = temp.getMethod("meth3", vettClax);
                        meth.invoke(o, vettParam);My problem is that the int value is catched as an Integer value and reflection doesn't found a method that accept an INTEGER as parameter, who can help me?

    Works fine when I try it.
    public class t
        public static void main(String args[])
         throws Exception
         Class temp = t.class;
         t o = new t();
         int num = 3;
         Class[] vettClax = {int.class};
         Object[] vettParam = {num};
         Method meth = temp.getMethod("meth3", vettClax);
         meth.invoke(o, vettParam);
        public void meth3(int n)
         System.out.println("hello " + n);
    }Is your meth3() public?

Maybe you are looking for

  • My iMac freezes up after starting, works fine in safe mode. What to do?

    Hey, I've got an iMac 3.06 GHz Intel Core 2 Duo 24" with Mac OS X 10.5.8 and a few days ago it froze while playing a game and watching an online video at the same time. When I turned it on the next morning all seemed fine but after half an hour it fr

  • Diskpart, drive letter removal using a wildcard

    I am trying to write a diskpart script to automatically set a drive letter to "F" the disk is always plugged into the same port, but anytime the computer reboots it assigns a different drive letter, but it never hands out the "F" letter to any other

  • WDRuntimeException: Exit-Plug must no be triggered with an URL when running

    Dear SAP, In our SRM-JAVA system, when I am leaving a web page, I get this error : The initial exception that caused the request to fail, was: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Exit-Plug must no be triggered with an URL whe

  • Establishing Palm Desktop 4.1.4 connectivity on Windows 2003 Server - using m500

    Admittedly, this is a legacy problem solution.  I was told by tech support that Palm could not support the m500 on Windows 2003 Server.  Via another connectivity solution, I learned that the pnp services needed to connect the palm m500 to my Windows

  • Mail App will not open....any ideas?

    Recently, while opening the mail app, I received an error message stating "You can't use this version of Mail with this version of Mac OS X - You have Mail version 4.5 (1084/1085). It can't be used on Mac OS X Version 10.6.8 (Build 10K549)." My softw