src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java

Fri, 11 Jun 2010 17:24:23 -0700

author
jjg
date
Fri, 11 Jun 2010 17:24:23 -0700
changeset 584
d1ea43cb71c1
parent 554
9d9f26857129
child 1053
0d8edba73d70
permissions
-rw-r--r--

6958836: javadoc should support -Xmaxerrs and -Xmaxwarns
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.javadoc;
    28 import java.util.regex.*;
    30 import com.sun.javadoc.*;
    32 /**
    33  * Represents an @param documentation tag.
    34  * Parses and stores the name and comment parts of the parameter tag.
    35  *
    36  * @author Robert Field
    37  *
    38  */
    39 class ParamTagImpl extends TagImpl implements ParamTag {
    41     private static Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
    43     private final String parameterName;
    44     private final String parameterComment;
    45     private final boolean isTypeParameter;
    47     ParamTagImpl(DocImpl holder, String name, String text) {
    48         super(holder, name, text);
    49         String[] sa = divideAtWhite();
    51         Matcher m = typeParamRE.matcher(sa[0]);
    52         isTypeParameter = m.matches();
    53         parameterName = isTypeParameter ? m.group(1) : sa[0];
    54         parameterComment = sa[1];
    55     }
    57     /**
    58      * Return the parameter name.
    59      */
    60     public String parameterName() {
    61         return parameterName;
    62     }
    64     /**
    65      * Return the parameter comment.
    66      */
    67     public String parameterComment() {
    68         return parameterComment;
    69     }
    71     /**
    72      * Return the kind of this tag.
    73      */
    74     public String kind() {
    75         return "@param";
    76     }
    78     /**
    79      * Return true if this ParamTag corresponds to a type parameter.
    80      */
    81     public boolean isTypeParameter() {
    82         return isTypeParameter;
    83     }
    85     /**
    86      * convert this object to a string.
    87      */
    88     public String toString() {
    89         return name + ":" + text;
    90     }
    92     /**
    93      * For the parameter comment with embedded @link tags return the array of
    94      * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
    95      *
    96      * @return TagImpl[] Array of tags with inline SeeTagImpls.
    97      * @see TagImpl#inlineTagImpls()
    98      * @see ThrowsTagImpl#inlineTagImpls()
    99      */
   100     public Tag[] inlineTags() {
   101         return Comment.getInlineTags(holder, parameterComment);
   102     }
   103 }

mercurial