Variable name refactoring

Is variable name refactoring supported in current release of jdeveloper? If not, is this planned and for what release?
Thanks!

It's not currently in JDeveloper, however you can use one of our Partners extensions like refactorit (http://www.refactorit.com/index.html?id=418) has for now.
Rob

Similar Messages

  • Which is worse: awkwardly long or vague/arbitrary variable names?

    I'm programming in C++, but that shouldn't matter.
    I'm working on a small chunk of code that is a module for a much, much larger project. Part of my code is to make several hundred histograms and then run some statistics over them.
    My dilemma is that there are so many, that naming them is becoming difficult. So, I opt for incredibly long, cumbersome names rather than short arbitrary names. Heck, even I wouldn't know what was going on if I just named them "histo1, histo2." Instead I name them things like "MomentumTimesDeltaPhiEta1" which MIGHT make sense to someone who is working on another part of the project.
    And actually, that wasn't a real example. Some of my names are longer than that. Is that normal? I have programmed in C++ for a year, but I'm still not good at programming etiquette, so my code looks clumsy.

    Local vars can be short, if you find the need to give further explanation, comment. Try to give meaningful names more for class atributes, interfaces, and where a variable name can help documenting the code itself. E.g. (Pseudo-code, as I don't remeber a lot of C++):
    Instead of:
    z = sqr(a^2 + b^2)
    This is better:
    // Pythagorean theorem
    z = sqr(a^2 + b^2)
    This is even better:
    hypotenuse = sqr(catheti_a^2 + catheti_b^2)
    If you find yourself using incredible long variable names, it's a signal that your program is too flat, and you need to start refactoring it into a function, class, or using a namespace.
    So, e.g:
    namespace Geometry {
    function Hypotenuse(float a, b) {
    return sqr(a^2 + b^2)
    The code expresses a lot more meaning, while staying concise.
    Edit: I forgot square root
    Last edited by freakcode (2008-08-06 19:49:58)

  • Same variable name causes major issues.....

    I would like to get some input and possible direction on the issue below... I am new to PL/SQL. Thanks in advance.....
    ..... The system is in the middle of processing a “For” step, i.e. a given “For” step is incomplete.
    ..... The script instructs the system to process a second “For” step with the same “for-loop variable” as the incomplete “For” step.
    When the above takes place, the system processes the second “For” step incorrectly. Instead of starting at the first value in the second “For” step’s list of values, the system begins in the middle of the value list.
    I need to change the current implementation so that if a "For" loop is encountered that has the same “loop variable” as a “For” loop already being executed, the “state” of the previous “For” step is discarded, and the state for the new “For” step is initialized to the first value in its list.
    -- Used for "for" steps
    TYPE for_list is table of varchar2(4000) index by binary_integer;
    TYPE for_loop_state is record (
    list for_list,
    next_index integer
    TYPE for_loops_list is table of for_loop_state index by steps.output_param%TYPE;
    all_for_loops for_loops_list;
    procedure for_step(list_string IN varchar2, ret_var_name IN varchar2, end_for_label IN varchar2) is
    state for_loop_state;
    end_idx number;
    list_value varchar2(4000);
    begin
    pkg_util.log('ret_var_name value after begin: ' || ret_var_name, 'I');
    -- get the current for list state, based on its output variable name
    if all_for_loops.exists(ret_var_name) then
    state := all_for_loops(ret_var_name);
    else
    state.next_index := 0;
    list_value := parse_next_param(list_string, 1, end_idx);
    -- end_idx is thrown away; for loops only have 1 input parameter (the list)
    state.list := get_for_list(list_value);
    all_for_loops(ret_var_name) := state;
    end if;
    if state.next_index < state.list.count then
    pkg_session_values.put(ret_var_name, state.list(state.next_index));
    all_for_loops(ret_var_name).next_index := state.next_index + 1;
    else
    all_for_loops.delete(ret_var_name);
    jump(end_for_label);
    end if;
    end;

    There is so much of your code hidden from view it is impossible to tell you anything other than perhaps suggest a methodology.
    Create a single variable with a known value and use dbms_output to view it as it steps through each piece of the puzzle. Determine when the value does something you don't want.

  • Using a variable's definition as a variable name

    I have a string variable with definition I need to use as a
    variable name.
    For example, this is super simplified:
    var newVariable = 'it is working';
    var partOne:String = 'new';
    var partTwo:String = 'Variable';
    var partThree = partOne + partTwo;
    trace("my variable is " + partThree);
    Instead of tracing partThree as literally partOne + partTwo
    (which traces "newVariable") i'd like it to trace the
    Definition of partOne + partTwo (which is "it is working").
    I hope this makes sense, help or advice is
    appreciated.

    ...
    var partThree = this[partOne + partTwo];
    trace("my variable is " + partThree); //will trace: my
    variable is it is working
    TS

  • How to declare internal table in BADI with variable name beginning with 0..

    Gurus,
    How to declare an internal table within a BADI. I have to implement a BADI UC_TASK_CUSTOM for BCS to BW load and there i have to  declare an internal table like:
    TYPES:          BEGIN OF t_cube_data,
                    0cs_version       TYPE /bi0/oics_version,
                    0sem_cgcomp       TYPE /bi0/oisem_cgcomp,
                    bcs_vers          TYPE /bic/oibcs_vers,
                    bcs_lcus          TYPE /bic/oibcs_lcus,
                    bcs_ldch          TYPE /bic/oibcs_ldch,
                    bcs_invcom       TYPE /bi0/oibcs_invcom,
                    bcs_litem         TYPE /bic/oibcs_litem,
                    bcs_llob          TYPE /bic/oibcs_llob,
                    bcs_lmay          TYPE /bic/oibcs_lmay,
                    0move_type        TYPE /bi0/oimove_type,
                    pcompany         TYPE /bi0/oipcompany,
                    bcs_lprg          TYPE /bic/oibcs_lprg,
                    figlxref3         TYPE /bic/oifiglxref3,
                    fiscyear         TYPE /bi0/oifiscyear,
                    fiscper3         TYPE /bi0/oifiscper3,
                    fiscvarnt        TYPE /bi0/oifiscvarnt,
                    curkey_gc        TYPE /bi0/oicurkey_gc,
                    unit             TYPE /bi0/oiunit,
                    cs_trn_gc        TYPE /bi0/oics_trn_gc,
                    cs_trn_qty       TYPE /bi0/oics_trn_qty,
              END OF t_cube_data
    But with this declaration it gives a error saying that u cannot have a variable beginning with 0...like 0cs_version....
    but i have to do it for my functionality to wrk...
    Please help me do it....
    how can i declare a internal table that allows me to have variable names that start with 0....
    Please help....Its URGENT....
    Thanks
    Sam

    Murali,
    I need to have 0 before the variable name in the declaration of the internal table....how can i attain that....
    Please suggest...
    Thanks
    Sam

  • Is it possible to add a property using variable in variable name?

    I want to query for a list of virtual machines within a folder, then create a menu of the host names using forms.  Since the list of machines is subject to change, I want to build the list each time the script is run, rather than build off a static
    list. 
    For each virtual machine I need to create the list of variables below:
    $hostnameX = New-Object System.Windows.Forms.checkbox
    $hostnameX.Location = New-Object System.Drawing.Size(10,20)
    $hostnameX.Size = New-Object System.Drawing.Size(100,20)
    $hostnameX.Checked = $true
    $hostnameX.Text = "Type"
    $hostnameX.Controls.Add($hostnameX)
    The location and size values need to be incremented but I think I can figure that part out.
    I can use New-Variable to generate the initial variable. But I receive errors using the same method to try to create a new property for the variable.
    $VMS = Get-Cluster MyCLUS | Get-vApp "My vApp" | Get-VM | Select Name,PowerState | Sort Name
    For ($i=0; $i -lt ($VMS.count); $i++)
    $VMS[$i].Name
    $VMGUEST = "$($VMS[$i].Name)" -replace("-","")
    New-Variable "CB$VMGUEST" "New-Object System.Windows.Forms.checkbox"
    New-Variable "CB$VMGUEST.Location" "New-Object System.Drawing.Size(10,20)"
    In the above, $CBVMGUEST1 =  New-Object System.Windows.Forms.checkbox which is what I want,  but $CBVMGUEST1.Location is not set.
    Is there way to add a property using a variable in the variable name?  Or any other suggestions on how to tackle this issue?

    Hi,
    maybe another approach is a bit easier.
    Use a hash-array like
    $CB = @{}
    $CB[$VMGUEST] = New-Object System.Windows.Forms....
    $CB[$VMGUEST].Location = New-Object System.Drawing....
    Mit freundlichen Grüßen Jens Kalski
    That's the correct answer.  Anytime you find yourself wanting to create variables named "Widget1", "Widget2", "Widget3", etc... it's a pretty clear indication that what you really need is a collection object of some sort.  That might be an array,
    a hashtable, or any other data structure for holding other objects, depending on your specific needs.

  • Error while using the variable name "VARIABLE" in variable substitution

    Hi Experts,
      I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
    This is the error in the channel:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
    Thanks,
    Diya

    Hi Zevik,
    Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
    Below is the configuration:
    Variable Substituition
    VARIABLE    payload:interface_dummy,1,Recordset,1,Header,1,field1,1
    Filename schema : TEST_%VARIABLE%.txt
    Output xml structure:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
    - <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
    - <Header>
      <identifier>HDR</identifier>
      <field1>001</field1>
      <field2>001</field2>
      <field3>R</field3>
      </Header>
    - <Detail>
      <identifier>A</identifier>
      <field1>000000002</field1>
      <field2 />
      <field3>Doretha.Walker</field3>
      </Detail>
    I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something !

  • Problem with variable name in ZXRSRTOP include (virtual KF)

    Hi all,
    I am coding a routine to use a virtual key figure in the BEx.
    I have just a little problem with the name of a variable:
    as explained in the documentation, I created the variable with the prefix G_POS_, the name of the infocube and the name of the infoobject all together:
    DATA: G_POS_BC_ST_003_C_DIV__C_COMPAR   type i.
    The problem is that this variable name is longer than 30 characters, so the system doesn't accept it.
    Is there a workaround, other than changing the name of the infoobject (which is a navigational attribute)?
    Any help would be appreciated.
    Loï

    Hello Marc,
    I understand that I have to use a concatenate function and a dynamic call of the variable with (variable) instruction, but i do not understand how to implement it.
    the infocube name is BC_ST_003
    the characterisdtic name is C_DIV__COMPAR
    So, in the include ZXRSRTOP the statement
    DATA : G_POS_BC_ST_003_C_DIV__COMPAR
    does not work due a length problem (see first post)
    But in the same include the statement
    +DATA: l_global_name type c.
    concatenate 'GPOS' 'BC_ST_003' 'C_DIV__C_COMPAR' into l_global_name separated by '_'.+
    drives to the following error : statement is not accessible.
    Could u please provide me with an example of the code in the include ZXRSRTOP, and in the include ZXRSRZZZ for the use of this variable.
    Thanks in advance.
    Loï

  • Servicegen - Issue with Variable Names - WLS 8.1

    Hi Experts
    I am trying to expose an EJB as a Webservice.. I assembled the ear using SERVICEGEN exposed by Weblogic 8.1
    To my dismay the generated WSDL (even the web-services.xml) are not having the variable names which I gave in my webservice method. Instead I get String, String0, String1 and so on...
    Kindly help me get over this problem.
    Thanks and Regards,
    Gopal.

    your application miight not be using this libraries but there are many shared libraries which are configured could be using. please check whether config.xml file of your domain contains the entries for this library.Problem running simple portal tutorial question

  • Dynamic Variable name (for int/long) from a String variable

    Hi,
    I want to give a int/long variable name from a String.
    for ex.
    String str = lookup + "Id";
    lookup is a String variable coming from XML. Now, for instance lookup="name". So str = "nameId".
    Now I want to create a int/long variable by nameId.
    Could anybody tell me the way how to do. Please don't tell to use MAP.
    Edited by: Shah on Dec 5, 2007 3:26 PM

    Well you can't. Use a Map.
    The compiler translates variable names into slot numbers, either within an object or withing the local "stack frame" and these slot numbers are assigned names at compile time. No new slots can be created at run time. Java is not Basic.
    Reflection allows you to find existing field names and methods (not local variables), so it's possible to map, for example, XML attribute names to field names or setters in an object but the names have to be known at compile time.

  • Unable to publish in Swf format. Get error message: 'Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name'. Anyone know how to fix?

    Unable to publish in Swf format. Get error message reads: 'Swf compilation failed. Note: Please verify if any of the actionscript keywords is used as user variable name'. Anyone know how to fix?

    Hi There,
    Can you tell me the Operating System and Captivate version you are using?
    Also can you confirm if you are getting this issue will this one project or all the projects? Try to copy paste this project on a new blank project and then try to publish.
    Regards,
    Mayank

  • Presentation Variable name being passed as value

    I have a requirement where value needs to be checked against two separate fields for filtering (as OR statement). But there should be ability to filter on these fields separately as well.
    Dashboard prompt:
    Province [Multi search]
    State [Multi search]
    Combined search (Province OR State Fields) [Edit Box] --- used to pass presentation variable
    Report filter:
    Province is prompted
    AND State is prompted
    AND Province is @{presentation_variable} (no default)
    OR State is @{presentation_variable} (no default)
    But if the text field with presentation variable in not used to filter, then the report shows no result because the presentation variable name itself is taken as a value. Any solution how this can be done making sure that if province only is searched for then the presentation variable is not passed as value and the query returns no results?
    Thanks everyone.

    Thanks Rachit, that helps. For the scenario mentioned initially, even this works:
    Province is @{presentation_variable} (no default)
    OR State is @{presentation_variable} (no default)
    But the challenge is if I want to add another filter (like country) also as a filter. When users filter only on country, then the report shows no results because no value has been passed to the presentation variable and the query generated uses presentation variable name as the value!

  • Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    What are the Variables settings, what is the text file’s content, …?

  • How do I create a variable name on the fly?

    Hi,
    If I have a String containing a value, how do I create a variable name using that value during program execution? That is if I have
    String fred = "newvar";
    How do I then create a new String with the name "newvar" (using the contents of fred)? I will never know what the content of fred is until this point. What I'd like to be able to do is something like
    String fred.subString(0) = "a new value";
    Obviously this won't work but if it did the statement would evaluate to something like
    String newvar = "a new value";
    Appreciate any help you can give,
    Dave.

    Here u go:
       private JCheckBox AddCheckBox( String strText, int nTextID )
          JCheckBox checkbox = null;
          Class checkboxDefinition;
          Class[] stringArgsClass = new Class[] {String.class};
          Constructor stringArgsConstructor;
          Object[] stringArgs = null;
          String arg = "";
          arg = "CheckBox" + nTextID;
          String label = new String(arg);
          stringArgs = new Object[] {label};
          try
            checkboxDefinition = Class.forName("javax.swing.JCheckBox");
            stringArgsConstructor = checkboxDefinition.getConstructor(stringArgsClass);
            checkbox = (JCheckBox) createObject(stringArgsConstructor, stringArgs);
            checkbox.setName(label);
            checkbox.setText(strText);
            checkbox.setSize(new java.awt.Dimension(CQuestionBase.PAGEWIDTH, 21));
            checkbox.putClientProperty("1",new Integer(nTextID));
            checkbox.setVisible(true);
          catch (ClassNotFoundException e)
            System.out.println(e);
          catch (NoSuchMethodException e)
            System.out.println(e);
          return checkbox;
       }This code was based on an example I found about two years ago. You can use the same methodolgy to create objects of any kind. Again, look at java.lang.Reflect.

  • Variable Names

    Hi
    Im trying to write a simple loop that will create n amount of data types by using a for loop
    for (int i=0;i<5;i++)
         MySet set+i=new MySet();
         }where it says MySet set+i i want it when it executes to read set1,set2,set3,etc so the variable name is the word set plus the number that i equals.
    set+i doesnt work, set.i doesnt work and set&i doesnt work. anyone know what it should be?

    You can't do this in Java. But you can declare an array and use the index to refer to each set like
    final int N = 5;
    MySet[] set = MySet[N]; // array of MySet
    for (int i=0; i<N; i++) {
       set[ i] = new MySet();
    }// set2 for example is now set[2].

Maybe you are looking for