Javadoc on method variables?

I'd like to be able to document method level variables with javadoc comments. Does anyone know if that's possible?
What I'm trying to do is to document exception handling inside a method and have a new tag handle the documentation. This way I can just re-run javadoc instead of having to manually update a separate document.
Any thoughts?
Thanks!
Shawn

Dear Doug,
I have checked the feature request for the link you mention. That feature is not being implemented.
I have the similar request that I need to be able to put the custom tag within the body of a method. Can you please confirm that Javadoc can parse the custom tag in the method body?
If yes, how can I access those information. Actually I need a program that extracts the special tag from source code for and create a special html format not like javadoc. For example. I would like to be able to put @todo in any part of the code and able to generate the list of the todo with it's description. I don't attempt to modify the javadoc format but want to be able to generate the custom document with custom tag.
What should be solution for this problem? I am very new to the Javadoc. What I am understanding is that the Javadoc will parse the code and we can access via the doclet. I would think that I need to modify the standard doclet to make this work. If the Javadoc doesn't parse any tag in the body of the method I will need to write the parser myself, which can be very time consuming.
-Bhuricha

Similar Messages

  • Checking Javadoc and Method Signature ?

    Hi All,
    Once i used Intellij IDEA. Now i am using eclipse for the past 1 year. In IntelliJ if the javadoc and method signature parameters were different it will automatically show a red color mark. so that we will correct it by seeing that.
    In eclipse i don't know that option...can anybody please let me know whether that option is avaiable in eclipse.
    How to check javadoc and method signature in other normal circumstances programmatically ?
    Thanks,
    J.Kathir

    That information is only available in the source code. I'm using Eclipse and it has the ability to link a jar to it's source (either another jar/zip or another project, or a directory on your disk). I imagine IntelliJ has a similar feature.
    Another option is to put the source code inside the jar that also contains the class files.

  • JavaDoc: inherit method comment from jdk classes?

    My goal is to let custom classes inherit method comments from overridden methods of jdk classes. From the doctool documentation, I would assume that the way to go is to set the path to the jdk sources in the -sourcepath option. My problem is that this doesn't seem to work at all - looks like JavaDoc is simply not parsing the JDK source files at all.
    The relevant (methinks :) part of the verbose output:
    // these are the input options as created by ant run from eclipse under win2k
    Executing 'D:\jdk\150_u6\bin\javadoc.exe' with arguments:
    '-d'
    'D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\dist\javadoc'
    '-use'
    '-splitindex'
    '-verbose'
    '-classpath'
    'D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\lib\optional\MultipleGradientPaint.jar'
    '-sourcepath'
    'D:\jdk_doc\srcjdk1.5.0;D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java'
    '-link'
    'file:D:/jdk_doc/jdk1.5b/docs/api'
    '-source'
    '1.5'
    'org.jdesktop.swingx.table'
    The ' characters around the executable and arguments are
    not part of the command.
    // following is the javadoc output
       [javadoc] [search path for source files: [D:\jdk_doc\srcjdk1.5.0,
    D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java]]
       [javadoc] [search path for class files:
    [D:\jdk\150_u6\jre\lib\rt.jar, D:\jdk\150_u6\jre\lib\jsse.jar,
    D:\jdk\150_u6\jre\lib\jce.jar, D:\jdk\150_u6\jre\lib\charsets.jar,
    D:\jdk\150_u6\jre\lib\ext\dnsns.jar,
    D:\jdk\150_u6\jre\lib\ext\junit.jar,
    D:\jdk\150_u6\jre\lib\ext\localedata.jar,
    D:\jdk\150_u6\jre\lib\ext\sunjce_provider.jar,
    D:\jdk\150_u6\jre\lib\ext\sunpkcs11.jar,
    D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\lib\optional\MultipleGradientPaint.jar]]
       [javadoc] Loading source files for package org.jdesktop.swingx.table...
       [javadoc] [parsing started
    D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java\org\jdesktop\swingx\table\ColumnControlButton.java]
    ..snip..
       [javadoc] Constructing Javadoc information...
       [javadoc] [loading
    D:\jdk\150_u6\jre\lib\rt.jar(java/awt/ComponentOrientation.class)]
       [javadoc] [loading
    D:\jdk\150_u6\jre\lib\rt.jar(java/awt/Dimension.class)]
       [javadoc] [loading D:\jdk\150_u6\jre\lib\rt.jar(java/awt/Insets.class)]It doesn't seem to matter if javadoc is run from the commandline or through an ant task, the output is basically the same.
    The loading from the rt.jar might be the problem, at least when comparing to a report about (maybe exactly the same) problem back in 2004
    http://forum.java.sun.com/thread.jspa?forumID=41&threadID=536074
    The posters stated that the -sourcepath didn't appear to work under win, while it did work under Solaris. When working, the [loading..] output contained the path to the sources instead of to the classes.
    Any help, hint, thought, comment highly welcome!
    Thanks in advance
    Jeanette

    Hi Doug,
    thanks for your prompt reply!
    My first question is what does the source tree look
    below this directory:
    -sourcepath 'D:\jdk_doc\srcjdk1.5.0
    de]
    To work, the the full path to, say, String.java,
    would need to be:D:\jdk_docs\srcjdk1.5.0\java\lang\String.java
    Because -sourcepath must point to the root of the
    source tree. Is this what you have?
    exactly, that's the case. In the meantime, I tried to put the sources somewhere relative to the classes (to exlude the possibility that the absolute path poses a problem)I want to document - to no avail.
    >
    Are you thinking that the class files are loaded from
    rt.jar rather than the source .java files from the
    source tree?
    well, you are the expert to interpret the output :-) All I can be sure of is that this looks similar to output (for windows) in the old forum thread I mentioned and similar to a couple of bug reports. f.i.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5079630 (which is closed as a duplicate) or
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5105600 which is still open (but probably should be closed - it's a usage error to point to the zipped sources).
    Hmm... thinking aloud: comparing my output to the output of the latter (it's quite analogous) it seems that in both cases the sources aren't found .. and the javadoctool falls back to get some search the missing information on the classpath. Maybe the question is: what could possibly go wrong (windows only) to not find the extracted sources (they are definitely there in my context ;-)?
    You might try setting -bootclasspath to the empty
    string, as describe here:
    http://java.sun.com/j2se/javadoc/faq/#bootclasspath
    I'll give it a try. BTW, this problem cropped up in the SwingLabs project, we are collectively scratching our heads in:
    http://forums.java.net/jive/thread.jspa?threadID=18409
    Thanks again!
    Jeanette

  • Review javadocs and method design

    the two file on the site are the files I want you to look at. The first is a pdf discribing the assignment. The other is a exicuteable jar containing my source code.
    http://students.washington.edu/cmartin0/
    I am new to using javadoc and find myself at a loss as to what to write. The comments always seem pointless because params and methods are rather self explanatory. I feel as though I end up repeating myself when describing many methods. particularity one's with return statements where I have to comment the return value and what the method dose. I would like advice on how to do javadoc commenting as apposed to normal commenting
    The part I'm most concerned about is the add method in ShoppingCart. I know it works but I don't think it is the best way of doing it. Every time a textfield in the GUI has action with a valid number it sends a new ItemOrder object to ShoppingCart to add to an array list used for computing the cost. So when changing a textfield from one number to another the last occurrence of that same order must be removed or altered to reflect the new change.
    After those two issues would you please give a over all look at the logic and design I used.
    Thank you.

    JavaDoc on simple getter/setter methods are hard to write, as they are ofent rather useless.
    What I usually do is to add not just which value a particular setter sets, but rather what that value means and how it is used in the class. Alternatively, you could put that information into the Class' JavaDoc (especially if you want to describe the interaction of several properties).
    Usually you'd like to keep all the information necessary for answering a question in the posting, having to download external stuff often makes people less inclined to help you. I've not looked into your program in too much detail, but it seems to be ok. One missing JavaDoc that I noticed is ItemOrder ("doing stuff...?" is not considered enough, usually ;-)).
    ShoppingCart.add() seems to be ok. Personally I'd have implemented it using a ListIterator, but that's not too important.
    Regarding the logic and design: They've been pretty much given in the assignment, so there wasn't much creative freedom for you.

  • Javadoc & private methods

    Hi,
    I'm creating an application during my trainig course. And I have a technical documentation to write in order to maintain my code. So I'm writting comments in the javadocs form, but the private methods and attributesdon't appeared in the javadocs, is there an option or something like this to create javadocs including private methods...
    Thanks
    S�bastien

    Sorry,
    in fact I've just found it, it's : javadoc -private MyClass.java
    S�bastien

  • What is the use of private static method/variable?

    Hi All,
    I have read lots of books and tried lots of things but still not very clear on the
    topic above.
    When exactly do we HAVE to use private static methods?
    private implies its only for class, cannot be accessed outside.
    But then static means, it can be accessed giving classname.method.
    They seem to be contradicting each other.
    Any examples explaining the exact behaviour will be well appreciated.
    Thanks,
    Chandra Mohan

    Static doesn't really "mean" that the method/field is intended for use outside the class - that is exactly what the access modifier is for.
    Static implies that it is for use in relation to the class itself, as opposed to an instance of the class.
    One good example of a private static method would be a utility method that is (only) invoked by other (possibly public) static methods; it is not required outside the class (indeed, it might be dangerous to expose the method) but it must be called from another static method so it, in turn, must be static.
    Hope this helps.

  • Passing variable in a method bean to JSP Page

    Hello Everyone,
    Can I Have a quick example of passing method variables from a java bean to a JSP page, (no forms involved)
    thanks

    Hello again,
    maybe I didn't explain my self correctly,
    I have a java program that read's from an external file. The program tokenizes the file (I use String Tokenizing). What I want is for the Tokenized string to display on a JSP page, How do I accomplish this?
    Below is a small fragment of my string Tokenizing program: Please I need help.
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
              DataOutputStream outFile = new DataOutputStream(
                               new FileOutputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/dev/jsp/wager_history.jsp"));
              String readDetail_topLayer;
           try
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t");
                   while  (tokenizer_topLayer.hasMoreTokens())
                        String string_gameID = tokenizer_topLayer.nextToken();
                        String string_roundID = tokenizer_topLayer.nextToken();
                        String string_bet = tokenizer_topLayer.nextToken();
                        String string_win = tokenizer_topLayer.nextToken();     
                        String string_roundDetail = tokenizer_topLayer.nextToken();     
                        String string_date_time = tokenizer_topLayer.nextToken();
                        System.out.println ("test tab!" + string_gameID);

  • Transportaion probled for Variable Substitutiom Method

    hi all,.
    we have done variable substitution method in DEV, but it not reflecting in QA.
    also tell me wht r the things we need to change manually after importing the object into INT and QA?
    regards
    sreeni

    Hi Chirag,
    Tank you very much.
    we are using CMS for this transportations in XI.
    I have created one CC as RCVR and we have used Message all as FCC.
    Now exported in DEV then it ready to import in CMS. If we import this in CONSODITION TAB of CMS, then it is imported into my QA.
    Now, I open the that Scenario in ID of QA.
    Here My doubt is:
    In CC channel we have give some values manually for  EXAMPLE, Target DIR.
    What abt file name scheme?
    If we use FCC and to get File Name as dynamic form PayLoad Values.
    For that we can use Variable Substitution Method using percenatge simbles.
    And we have to check the check box for Variable Substitution Method Enable.
    After checking the check box, we have to give variable names and values from PayLoad data.
    Ok,
    now my doubt is,
    Whethere we have to change the following manually or not.
    1) Taget Directory
    2) File name scheme
    3) FTP Server Name
    4) User ID (FTP)
    5) Pasword
    6)Check Box (for Variable Substitution Method Enable)
    7)For this Variable Substitution Method, variable names which we used for  FIle Name Scheme and its values   right.
    plz
    revert
    regards
    sreeni

  • Best Practice:  Using a static variables and methods vs singleton pattern

    Just curious, since when anything, within a class, is denoted as static it typically will be stored in main memory as a class property(method, variables, etc). Is it a good practice to be doing this all the time or is the singleton pattern a better choice. Please explain why. Thanks.

    I wouldnot make anything other than the constants and the instance itself static. And I cant think of a reason wjy one would.

  • Passing a variable from init to actionPerformed method

    hi everyone!
    i d like your help on how i can pass two variables (wager, bankBalance)
    to actionPerformed method. variable bankBalance is initialized out of init method(is it right?) and i prompt the user to set a wager in the method init.
    i want to pass these values in actionPerformed in order to do the calculation bankBalance+wager.
    public class Wager extends JApplet implements ActionListener {
         JLabel die1Label, die2Label, sumLabel, pointLabel;
         JTextField die1Field, die2Field, sumField, pointField;
         JButton rollButton;
         final int WON=0, LOST=1, CONTINUE=2;
         int bankBalance=1000;
         boolean firstRoll=true;
         int sumOfDice=0;
         int myPoint=0;
         int gameStatus=CONTINUE;
         // setup GUI components
         public void init()
         int i;      
         do {
      String k = JOptionPane.showInputDialog(null, "Enter a number less than 1000 but greater than 0");
       wager= Integer.parseInt(k);
    } while (wager > 1000 || iwager< 1);
    public void actionPerformed (ActionEvent actionEvent)
    {

    This was answered in the other thread that you double posted. What's the problem?
    You can't PASS those to ActionPerformed. Like I said before, you have to make them class variables:
    public class Wager implements ActionListener
        private int wager;
        public void actionPerformed(ActionEvent event)
            // Now you can work with wager here, because it's a class variable.
    }%

  • Why we are making a variable as final in method inner class ?

    Why we are making the variable as final (method inner class) while we are accessing the method variable in inner class ?
    regards,
    namanc

    As far as I can tell, the only reason is to protect the programmer: when the inner class instance is constructed, it is given the then-current value of the variable. If the variable (or method parameter) later changes, the value held by the inner class would not. By making the variable final, the programmer doesn't have to worry about them staying in sync.
    Here's some code to ponder:
    public class InnerExample
        void printMe( final int x )
            Runnable runMe = new Runnable()
                public void run()
                    System.out.println(x);
            (new Thread(runMe)).start();
    }When compiled with the Sun JDK 1.4.2, you get this bytecode:
    void printMe(int);
      Code:
       0:   new     #2; //class InnerExample$1
       3:   dup
       4:   aload_0
       5:   iload_1
       6:   invokespecial   #3; //Method InnerExample$1."<init>":(LInnerExample;I)V
       9:   astore_2
       10:  new     #4; //class Thread
       13:  dup
       14:  aload_2
       15:  invokespecial   #5; //Method java/lang/Thread."<init>":(Ljava/lang/Runnable;)V
       18:  invokevirtual   #6; //Method java/lang/Thread.start:()V
       21:  returnAt line (byte) 5, it loads the passed value onto the stack; at line 6, it invokes the inner class constructor (which is created by the compiler). Nothing in this sequence of code would prevent use of a non-final variable.

  • Inaccessible with local variable(non-final) via method local inner class

    Hi All,
    Usually local variables, including automatic final variable live on the stack and objects & instanace variables live on the heap.The contracts for using the method local inner class should allow merely method final variable, not non-final stack variable.
    Can anyone please clarify me ,behind the scene what is actual fact why method inner class should not access the stack(method) variable and only allow final variable?
    Is anything correlated with the stack and heap aspects?
    Thanks,
    Stalin.G

    [email protected] wrote:
    ...behind the scene what is actual fact why method inner class should not access the stack(method) variable and only allow final variable?...explained by dcminter and Jardium in [an older thread|http://forums.sun.com/thread.jspa?messageID=10694240#10694240|http://forums.sun.com/thread.jspa?messageID=10694240#10694240]:
    ...Final variables are copied into inner classes - that's why they have to be declared final; to avoid the developer making an incorrect assumption that the local variable can be modified and have the change reflected in the copy.
    When a local class uses a local variable, it doesn't actually use the variable. Instead, it takes a copy of the value which is contained in the variable at the moment the class is instantiated. It's like passing the variable to a constructor of the class, except that you do not actually declare any such constructor in your code.
    To avoid messy execution flows to be present in a Java method, the Java language authors thought it was better to allow a single value to be present in such a variable throughout all its life. Thus, the variable has to be declared final.
    ...HTH

  • What is javadoc for and how can i use it?

    Hello,
    I want to know what for
    */is and how I can use it?

    It works like this:
    You add comments between /** and */ in your source code for all your classes, methods, variables etc. Then you run the javadoc tool, which is included with the JDK. Read the Javadoc Tool Documentation for instructions about how to use it.
    The javadoc tool looks at the comments in your source code and generates a directory containing HTML pages. The HTML pages contain the documentation of all your classes and methods.
    Why would you want this? Because other people who are going to use your source code do not want to browse through all of your source code all the time to find out how your classes work. Having a good manual in the form of HTML pages generated by javadoc is much more convenient.

  • How to get a int value from another class method?

    Hi,
    how can I get a value of another class method variable value.
    example,
    class elist
            int a;
         ArrayList<Event> eventArray;
         void addEvent(Event e);
         Event getEvent(int index);
         void removeEvent(int index);
         void orderEventByTime();
    interface Event
         void Command();
    class servo implements Event
         String ip;
         int time = 10;
         void Command();
    class servo_2 implements Event
         String ip;
         int time = 20;
         void Command();
    [\code]
    I want to get the time value in elist variable a; 
    and want to compare each class time?.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    1) this foum provides means to format/tag code, no need to manually add -tags
    2) by default, classname start with a capital letter, method names with a lower case letter
    3) where do you want to get the time value to Elist.a? During addEvent()?
    4) what do you want to do with the time value of each event? Sum all values up to make a an overall sum?
    5) where do you want to compare the time value(s)?
    To put it in one sentence: please be more specific with your description and answer.
    Bye.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using Java Reflection to call a method with int parameter

    Hi,
    Could someone please tell me how can i use the invoke() of the Method class to call an method wiht int parameter? The invoke() takes an array of Object, but I need to pass in an array of int.
    For example I have a setI(int i) in my class.
    Class[] INT_PARAMETER_TYPES = new Class[] {Integer.TYPE };
    Method method = targetClass.getMethod(methodName, INT_PARAMETER_TYPES);
    Object[] args = new Object[] {4}; // won't work, type mismatch
    int[] args = new int[] {4}; // won't work, type mismatch
    method.invoke(target, args);
    thanks for any help.

    Object[] args = new Object[] {4}; // won't work, type
    mismatchShould be:
        Object[] args = new Object[] { new Integer(4) };The relevant part of the JavaDoc for Method.invoke(): "If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException. "
    I suppose you could pass in any Number (eg, Double instead of Integer), but that's just speculation.

Maybe you are looking for

  • Dynamic updates in JSP

    How to save and display the values entered in the JSP without Refreshing? Values entered in JSP must be saved in database and automatically get loaded in the same JSP without Refreshing if you click some button in the JSP

  • IPhoto 11 (9.3) Why won't date range work for 2012?

    We upgraded to the new iMac and iPhoto 11 a couple weeks ago. The Smart Albums look to have converted correctly, including the ones I created for any one years' photos "All - 2011," "All - 2010," and "All - Best of 2009," etc. Those converted albums

  • Is there a group policy to force all workstations in an OU to logoff?

    Hello, Is there a group policy to force all workstations in an OU to logoff? Thanks in advance.

  • What is the best way to lay out color-coded Excel data in InDesign?

    I've been away from layout for some time. I now need to lay out color-coded Excel data (3 columns, 200 rows) in InDesign 5.5. The data will need to be in alpha order and each row will be color coded, with a color key at the top of the page. What is t

  • Reports 6i Fixed Problem

    I want to print invoice with the help of report 6i. But I am not able to fix gaps between the place of total amount and detailed record . I want to print invoice amount at specified place on every invoice. I do not want anchoring. null