Problem naming a method

Hi,
In a part of my project I have an defined a class A. A has several attributes, classified in two groups: fix ones and evolving ones. To reflect this in data base I have two different tables
- FixA: fix data of A. PK is A's id.
- EvoA: evolutive data of A. PK is A's id and the number of instance.
To reflect this in memory, I created two clases called FixA and EvoA. One of the attributes of EvoA is "instance".
E.g. I want to insert the A object with id 1, I would create the FixA instance of A, with id 1 and would create a EvoA object with id=1 and instance=1, apart from the other values. If I have to introduce A another time and some values have changed, I won't create the FixA instance with id=1 (because it already exists) but will create a new EvoA with id=1 and instance=2, apart from the rest of values.
Of course, each attribute has it's own getter/setter. My problem is that I want to create a static method in EvoA which returns me an instance of EvoA called getInstance. Since the name would be the same and the name getInstance normally refers to this second option, can anybody recomend me a nice name for the attribute instance?
Thanks

>
It actually looks like your attribute that currently is named instance should be renamed to version. Naming it instance is confusing since most developers would think of something else.
Kaj

Similar Messages

  • Idcs6[win/mac] problem naming custom methods inside scripting dom.

    Hi,
    I defined some custom methods for the scripting dom in my model plugin. They are working perfectly, but there's a little problem.
    Following is the declaration of my method:
    resource VersionedScriptElementInfo(0)
        // Contexts
            // Scripting support added at InDesign CS 2.0
            kFiredrakeScriptVersion, kCoreScriptManagerBoss, kInDesignAllLanguagesFS, k_Wild,
            kFiredrakeScriptVersion, kCoreScriptManagerBoss, kInCopyAllLanguagesFS, k_Wild,
    // Elements
            // Specifies an Method
    Method
                kXYZElement,
                e_xyz,
                "getStringoneStringtwoStringthree",
                "Does xyz operation",
                StringArrayType(2),
                "xyz",
                    p_Param1, "param1", "Param1", StringType, kRequired,
                    p_Param2, "param2", "Param2", StringType, kRequired,
            // Connects this plug-in's methods and properties to scripting.
            Provider
                kXYZScriptProviderBoss,    // provider boss ID
                    Object{ kApplicationObjectScriptElement },
                    Method{ kXYZElement},
    Now my problem is that I can access the getStringoneStringtwoStringthree method in the scripting dom but the method name gets converted to getstringonestringtwostringthree
    (the capital letters in the method name get small).
    So, am i missing something during the declaration ? 
    Regards
    maddy1907

    Hi,
    I found the error. You need to define "getStringoneStringtwoStringthree", like "get stringone stringtwo stringthree", 
    Then OMV will show your methods as getStringoneStringtwoStringthree.
    Similarly, you need to do this for parameters name too.
    Regards
    maddy1907

  • I have problem with pay method

    I have problem with pay method. My card declined. I change card and I have the same problem. What can i do? Why declined my card again?

    Contact iTunes store support: https://ssl.apple.com/emea/support/itunes/contact.html.

  • Problem with traverse method

    Hi, I am having this problem:
    I made a CustomItem, a TextField, now I overloaded the traverse method, so if the keycode is Canvas.UP or Canvas.DOWN then return false else return true.
    The problem is that when I press the left or rigth button it also returns false and not true.
    and there is another problem with traverse, before returning false or true I set a boolean and call to repaint to draw it on some way if its selected or not, the paint method is being called but it just dont draw as desired.
    protected void paint(Graphics g, int ancho, int alto) {
              System.out.println ("Dentro del paint, seleccionado="+seleccionado);
              try {
                   g.drawString(label, 0, 0, Graphics.TOP|Graphics.LEFT);
                   if (!seleccionado) {
                        g.setColor(120, 120, 120);
                   g.drawRect(0, 4, tama�oTexto+8, 25);
                   if (seleccionado) {
                        g.setColor(255, 255, 255);
                        g.fillRect(1, 5, (tama�oTexto+8-1), 23);
                   g.setColor(0, 0, 0);
                   if (!seleccionado) {
                        g.setColor(80, 80, 80);
                   g.drawString(texto, 4, 7, Graphics.TOP|Graphics.LEFT);
                   if (seleccionado) {
                        int cursorX=Font.getDefaultFont().charsWidth((texto.substring(0, idLetraActual)).toCharArray(), 0, texto.substring(0, idLetraActual).length())+4;
                        g.drawChar('|', cursorX, 7, Graphics.TOP|Graphics.LEFT);
              } catch (Exception E){
                   E.printStackTrace();
         }the traverse method set the seleccionado variable and calls to repaint but instead of being false the paint method is drawing it as true (most of times).

    I have a problem with findByxxx() method.. in
    Container managed bean.
    i have
    Collection collection =
    home.findByOwnerName("fieldValue");
    specified in my Client Program, where ownerName is the
    cmp fieldname..
    and
    public Collection findByOwnerName(String ownerName)
    throws RemoteException, FinderException
    defined in my home interface.
    i have not mentioned the findBy() method anywhere else
    (Bean class). You have to describe the query in the deployment descriptor.
    >
    Even if i have a same "fieldValue" in the database
    (Oracle), which i specified in findBy() method, iam a
    result of owner Not found, which is not the case as i
    have that owner name.
    for the same application if i use findByPrimaryKey(),
    it is working..
    Can any one please post me the solution.

  • Problem with Vector method addElement

    I am new to Java. I am using JDK 1.3. I am writing a program that will convert a text file to a binary file that stores a Vector object. I have narrowed my problem to the method that reads the text file and creates my vector. Each element in my vector stores an integer and a string variable. The reading of the text file works find and the creation of my record works find. It seems that the storing of the record in the vector is not working. When I print the first 10 elements of the vector, it have the same record(the last record of my text file). What is wrong with the method below? I am also appending the result of running my program.
    private static void readTextFile(File f) {
    try {
    FileReader fileIn = new FileReader(f);
    BufferedReader in = new BufferedReader(fileIn);
    String line;
    int i;
    SsnLocationRecord recordIn = new SsnLocationRecord();
    int ctr = 0;
    while (true) {
    line = in.readLine();
    if (line == null)
    break;
    ctr += 1;
    i = line.indexOf(" ");
    recordIn.putAreaNumber(Integer.parseInt(line.substring(0,i).trim()));
    recordIn.putLocation(line.substring(i+1).trim());
    records.addElement(recordIn);
    if (ctr < 11)
    System.out.println(recordIn);
    in.close();
    } catch (IOException e) {
    System.out.println ("Error reading file");
    System.exit(0);
    for (int i = 0; i < 11; i++)
    System.out.println((SsnLocationRecord) records.elementAt(i));
    RESULTS:
    C:\Training\Java>java ConvertTextFileToObjectFile data\ssn.dat
    0 null
    3 New Hampshire
    7 Maine
    9 Vermont
    34 Massachusetts
    39 Rhode Island
    49 Connecticut
    134 New York
    158 New Jersey
    211 Pennsylvania
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    C:\Training\Java>

    First of all it would be better if you did a priming read and then checked line == null in the while statement instead of the way you have it.
    ctr++ will also accomplish what ctr +=1 is doing.
    you need to create a new instance of SsnLocationRecord for each line read. What you are doing is overlaying the objects data each time you execute the .putxxxx methods. The reference to the object is placed in the vector. The actual object is still being updated by the .putxxx methods (NOTE : THIS IS THE ANSWER TO YOUR MAIN QUESTION).
    you close should be in a finally statement.
    To process through all the elements of a Vector create an Enumeration and then use the nextElement() method instead of the elementAt is probably better. (Some will argue with me on this I am sure).
    Also, on a catch do not call System.exit(0). This will end your JVM normally. Instead throw an Exception (Runtime or Error level if you want an abnormal end).

  • Problem with prerender method

    Hi,
    I have a problem with the method prerender. A month ago, I started to develop a web project using Sun Studio Creator and a few page beans that i used extended the Abstract Page Bean, so I overrided the prerender and customized it.
    The problem is that, now i'm using eclipse and the configuration files of the project has changed and the prerender method never execute.
    I want to know why it is happening. Maybe the project is "bad-configurated"?
    Thanks

    The code of java bean doesn't change, the only thing that has changed is the configuration files (faces-config.xml, web.xml, etc).
    I put a breakpoint in the prerender method but the lifecycle doesn�t execute this method.
    After serveral changes, I wrote this code in the method prerender :
    int i=0;
    i = 1;
    And the prerender method doesn't execute.
    I'm a bit lost,
    thanks

  • Problem with affinetransformOp method...

    I have a serious problem with filter method
    I Want to make a image flipping or some other filtering by using
    AffineTransformOp
    but it printouts an erro like this
    cannot resolve symbol
    op.filter (img, flipped)
    (the error pointer shows ".after the op")
    a code from my one of the filters
    BufferedImage flipped = new BufferedImage(img.getHeight(), img.getWidth(),BufferedImage.TYPE_INT_RGB);
    AffineTransform trans = new AffineTransform(0, 1, 1, 0, 0, 0);
    AffineTransformOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    op.filter(img, flipped); //img is my buffered image source
    I used some other ways like (img, null) but always give out error.
    thanks..

    Did you declare "img" as BufferedImage or something else?
    What is the full error message?

  • Problem with WindowClosing() method

    Hello everyone,
    I have some problem with WindowClosing() method, in which I gave options
    to quit or not. Quit is working fine but in case of Cancel, its not returning to
    the frame. Can anyone help me ....Here is my code
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    public class TestFrame extends JPanel
         public static void main(String[] args)
              JFrame frame = new JFrame("Frame3");
              WindowListener l = new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        int button = JOptionPane.showConfirmDialog(null,"OK to Quit","",JOptionPane.YES_NO_OPTION, -1);
                        if(button == 0)     {
                             System.exit(0);
                                   else
                                              return;
              frame.addWindowListener(l);
              frame.setSize(1200,950);     
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    }

    Maybe try
    int button = JOptionPane.showConfirmDialog(yourframe,"OK to
    Quit","",JOptionPane.YES_NO_OPTION, -1);

  • Problems using GET method in JSP

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET method in JSP?
    If anyone have solutions, please let me know.
    thanks.

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in
    windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is
    good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET
    method in JSP?
    If anyone have solutions, please let me know.
    thanks.This problem appears, when one use UTF-16 encoding in JSP - am I right?
    If so there are two solutions:
    1) Temporary: Use "UTF-8" - or any other 8 bit encoding scheme and
    encode Korean symbols with "&1234;" kind of escapes - though it
    may not work
    2) Absolute: get my piece of code, which I have managed to write
    just a month ago resolving absolutely similar problem with UTF-16
    in code using Chinese/Russian/English encodings
    But I wouldn't say that it's costs 10 DDs :) - it's much more
    expensive... So try 1st variant if it wouldn't help - let me know.
    I'll figure :)
    Paul

  • Screen Resolution Problem in Session Method

    Hi
    I want to use session method in BDC. How to resolve screen resolution problem in Session Method?
    Please give me the code or steps regarding this.
    Thanks & Regards
    venkateswararao

    Hi
    U can only run the session with the option Dynpro Standard Size setted.
    In this way the system should be use the same resolution for every situation.
    Max

  • Problems w my method paymet

    Problems w my method payment

    Go to settings/itunes & app store tap on ID then view ID then tap payment information and see whether paypal is a payment option for you.  If it is not then you will need to check from one of the available payment options

  • I have problem verifying payment method by my pre-paid visa credit card

    I have a problem verifying payment method by my pre-paid visa credit card ???

    Apple does not accept pre paid cards >  iTunes Store: Accepted forms of payment
    Purchase an iTunes gift card that you can redeem and use to purchase iTunes and App Store content.
    http://www.apple.com/itunes/gifts/?cid=wwa-us-kwg-music-itu

  • I am trying to install free apps but I always get billing problem? Payment Method!!?

    I am trying to install free apps but I always get billing problem? Payment Method!!?

    Likely because you are trying to create a Mac App Store account with an existing Apple ID. The None option often is not available in that case. If you create a new Apple ID and iTunes/Mac App Store account following these instructions carefully, you will be successful in getting free apps without a payment method.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card -
    http://support.apple.com/kb/HT2534

  • Problem with doubleValue() method and hashtable

    Hi,
    I made a type double variable named tempNumber.
    and I used this to put that number in a hashtable
    CODE 1 : hash.put(key, new Double(tempNumber));
    Then I wrote this code to retrieve it.
    CODE 2: (hash.get(st.sval)).doubleValue();
    Note: I am using streamtokenizer to get the nexttoken, so st.sval is a string representation of the token.
    Now my problem is when I compile CODE 2, I get an error message saying that "method doubleValue() not found in java.lang.Object". Whats going on here??
    I am using java 1.1 by the way.
    Thanks in advance...

    Hash table stored and returns objects. You have to typecast the return value of get() method to Double and then call doubleValue() on it.
    Its something as follows
    ((Double)hash.get(key)).doubleValue()

  • Problem executing RMI Methods Netbeans

    Hi everyone!
    I�m using a system Servlet+applet that communicate by RMI with Netbeans.
    The remote object, the stub and the binding are correctly created at the servlet. At the applet the reference to the remote object is ok too.
    The problem appears when I invoke a method in the remote object from the applet.
    The message the Java console throws:
    RemoteException  en soloEscribe()
    java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.1.100:1079 connect,resolve)
    soloEscribe() is the method in the remote object.
    I�m running everything locally, and I have granted allPermissions at the java.policy.
    Hope someone can help!
    Edited by: SnowyC on May 18, 2008 11:31 AM

    and one more thing I added following lines
    Context rootContext=(Context)initialNamingContext.lookup("");
    System.out.println("The Look up suceeded");
    to see whether it is able to look up the root context or not.
    I saw that it is suceeded in finding the root context and print the message also , but again failed to rebind the object .thrwing following exception
    java -classpath . -Djava.naming.factory.ini
    tial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://local
    host:1050 Registry
    Inside Constructor
    The Look up suceeded
    java.lang.IllegalArgumentException: Only instances of org.omg.CORBA.Object can b
    e bound
    at com.sun.jndi.cosnaming.CNCtx.callBindOrRebind(Unknown Source)
    at com.sun.jndi.cosnaming.CNCtx.rebind(Unknown Source)
    at com.sun.jndi.cosnaming.CNCtx.rebind(Unknown Source)
    at javax.naming.InitialContext.rebind(Unknown Source)
    at Registry.main(Registry.java:30

Maybe you are looking for

  • How can I change the colour of an iCal calender on the iPhone?

    I have two iCal calendars on my iPhone that sync to google. It works fine with push but both of hem has the same colour. That makes it hard to see the diference. How can I change the colour? I am syncing to outlook so I don't have iCal on the statona

  • I want to increase partition size

    i want to increase partition size in my imac while installing windows 7 but it allocates only 20gb of space to to windows i want to increase it , how do i do it?,i havent installed windows yet because i want to allocate more space for windows

  • Internal and External Reconciliations

    I am looking to find out what the differences are with Internal and External Reconciliations. I am not sure if I need to use Internal or External when doing Manual Reconciliations in banking. Thanks! Dayna

  • Flex Engineer Needed in Atlanta, GA (Urgent)

    Requirements: Bachelor's degree in Computer Science or related field preferred Experience developing web based applications using Adobe Flex Experience architecting web based applications using Adobe Flex Must have experience leading and participatin

  • How can we get pages 09 and Keynote back?

    I understand from the forums that Pages was changed in order to adapt to the IOS. The IOS should have adapted to Mac. How embarassing. No setup for tool bar as before for the items that you use consistently. Pages 09 worked very well and now it is li