src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java

changeset 1735
8ea30d59ac41
parent 1606
ccbe7ffdd867
child 1737
7a9ef837e57f
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Fri May 10 15:15:50 2013 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue May 14 10:14:51 2013 -0700
     1.3 @@ -38,177 +38,181 @@
     1.4   */
     1.5  public class LinkInfoImpl extends LinkInfo {
     1.6  
     1.7 -    /**
     1.8 -     * Indicate that the link appears in a class list.
     1.9 -     */
    1.10 -    public static final int ALL_CLASSES_FRAME = 1;
    1.11 +    public enum Kind {
    1.12 +        DEFAULT,
    1.13  
    1.14 -    /**
    1.15 -     * Indicate that the link appears in a class documentation.
    1.16 -     */
    1.17 -    public static final int CONTEXT_CLASS = 2;
    1.18 +        /**
    1.19 +         * Indicate that the link appears in a class list.
    1.20 +         */
    1.21 +        ALL_CLASSES_FRAME,
    1.22  
    1.23 -    /**
    1.24 -     * Indicate that the link appears in member documentation.
    1.25 -     */
    1.26 -    public static final int CONTEXT_MEMBER = 3;
    1.27 +        /**
    1.28 +         * Indicate that the link appears in a class documentation.
    1.29 +         */
    1.30 +        CLASS,
    1.31  
    1.32 -    /**
    1.33 -     * Indicate that the link appears in class use documentation.
    1.34 -     */
    1.35 -    public static final int CONTEXT_CLASS_USE = 4;
    1.36 +        /**
    1.37 +         * Indicate that the link appears in member documentation.
    1.38 +         */
    1.39 +        MEMBER,
    1.40  
    1.41 -    /**
    1.42 -     * Indicate that the link appears in index documentation.
    1.43 -     */
    1.44 -    public static final int CONTEXT_INDEX = 5;
    1.45 +        /**
    1.46 +         * Indicate that the link appears in class use documentation.
    1.47 +         */
    1.48 +        CLASS_USE,
    1.49  
    1.50 -    /**
    1.51 -     * Indicate that the link appears in constant value summary.
    1.52 -     */
    1.53 -    public static final int CONTEXT_CONSTANT_SUMMARY = 6;
    1.54 +        /**
    1.55 +         * Indicate that the link appears in index documentation.
    1.56 +         */
    1.57 +        INDEX,
    1.58  
    1.59 -    /**
    1.60 -     * Indicate that the link appears in serialized form documentation.
    1.61 -     */
    1.62 -    public static final int CONTEXT_SERIALIZED_FORM = 7;
    1.63 +        /**
    1.64 +         * Indicate that the link appears in constant value summary.
    1.65 +         */
    1.66 +        CONSTANT_SUMMARY,
    1.67  
    1.68 -    /**
    1.69 -     * Indicate that the link appears in serial member documentation.
    1.70 -     */
    1.71 -    public static final int CONTEXT_SERIAL_MEMBER = 8;
    1.72 +        /**
    1.73 +         * Indicate that the link appears in serialized form documentation.
    1.74 +         */
    1.75 +        SERIALIZED_FORM,
    1.76  
    1.77 -    /**
    1.78 -     * Indicate that the link appears in package documentation.
    1.79 -     */
    1.80 -    public static final int CONTEXT_PACKAGE = 9;
    1.81 +        /**
    1.82 +         * Indicate that the link appears in serial member documentation.
    1.83 +         */
    1.84 +        SERIAL_MEMBER,
    1.85  
    1.86 -    /**
    1.87 -     * Indicate that the link appears in see tag documentation.
    1.88 -     */
    1.89 -    public static final int CONTEXT_SEE_TAG = 10;
    1.90 +        /**
    1.91 +         * Indicate that the link appears in package documentation.
    1.92 +         */
    1.93 +        PACKAGE,
    1.94  
    1.95 -    /**
    1.96 -     * Indicate that the link appears in value tag documentation.
    1.97 -     */
    1.98 -    public static final int CONTEXT_VALUE_TAG = 11;
    1.99 +        /**
   1.100 +         * Indicate that the link appears in see tag documentation.
   1.101 +         */
   1.102 +        SEE_TAG,
   1.103  
   1.104 -    /**
   1.105 -     * Indicate that the link appears in tree documentation.
   1.106 -     */
   1.107 -    public static final int CONTEXT_TREE = 12;
   1.108 +        /**
   1.109 +         * Indicate that the link appears in value tag documentation.
   1.110 +         */
   1.111 +        VALUE_TAG,
   1.112  
   1.113 -    /**
   1.114 -     * Indicate that the link appears in a class list.
   1.115 -     */
   1.116 -    public static final int PACKAGE_FRAME = 13;
   1.117 +        /**
   1.118 +         * Indicate that the link appears in tree documentation.
   1.119 +         */
   1.120 +        TREE,
   1.121  
   1.122 -    /**
   1.123 -     * The header in the class documentation.
   1.124 -     */
   1.125 -    public static final int CONTEXT_CLASS_HEADER = 14;
   1.126 +        /**
   1.127 +         * Indicate that the link appears in a class list.
   1.128 +         */
   1.129 +        PACKAGE_FRAME,
   1.130  
   1.131 -    /**
   1.132 -     * The signature in the class documentation.
   1.133 -     */
   1.134 -    public static final int CONTEXT_CLASS_SIGNATURE = 15;
   1.135 +        /**
   1.136 +         * The header in the class documentation.
   1.137 +         */
   1.138 +        CLASS_HEADER,
   1.139  
   1.140 -    /**
   1.141 -     * The return type of a method.
   1.142 -     */
   1.143 -    public static final int CONTEXT_RETURN_TYPE = 16;
   1.144 +        /**
   1.145 +         * The signature in the class documentation.
   1.146 +         */
   1.147 +        CLASS_SIGNATURE,
   1.148  
   1.149 -    /**
   1.150 -     * The return type of a method in a member summary.
   1.151 -     */
   1.152 -    public static final int CONTEXT_SUMMARY_RETURN_TYPE = 17;
   1.153 +        /**
   1.154 +         * The return type of a method.
   1.155 +         */
   1.156 +        RETURN_TYPE,
   1.157  
   1.158 -    /**
   1.159 -     * The type of a method/constructor parameter.
   1.160 -     */
   1.161 -    public static final int CONTEXT_EXECUTABLE_MEMBER_PARAM = 18;
   1.162 +        /**
   1.163 +         * The return type of a method in a member summary.
   1.164 +         */
   1.165 +        SUMMARY_RETURN_TYPE,
   1.166  
   1.167 -    /**
   1.168 -     * Super interface links.
   1.169 -     */
   1.170 -    public static final int CONTEXT_SUPER_INTERFACES = 19;
   1.171 +        /**
   1.172 +         * The type of a method/constructor parameter.
   1.173 +         */
   1.174 +        EXECUTABLE_MEMBER_PARAM,
   1.175  
   1.176 -    /**
   1.177 -     * Implemented interface links.
   1.178 -     */
   1.179 -    public static final int CONTEXT_IMPLEMENTED_INTERFACES = 20;
   1.180 +        /**
   1.181 +         * Super interface links.
   1.182 +         */
   1.183 +        SUPER_INTERFACES,
   1.184  
   1.185 -    /**
   1.186 -     * Implemented class links.
   1.187 -     */
   1.188 -    public static final int CONTEXT_IMPLEMENTED_CLASSES = 21;
   1.189 +        /**
   1.190 +         * Implemented interface links.
   1.191 +         */
   1.192 +        IMPLEMENTED_INTERFACES,
   1.193  
   1.194 -    /**
   1.195 -     * Subinterface links.
   1.196 -     */
   1.197 -    public static final int CONTEXT_SUBINTERFACES = 22;
   1.198 +        /**
   1.199 +         * Implemented class links.
   1.200 +         */
   1.201 +        IMPLEMENTED_CLASSES,
   1.202  
   1.203 -    /**
   1.204 -     * Subclasses links.
   1.205 -     */
   1.206 -    public static final int CONTEXT_SUBCLASSES = 23;
   1.207 +        /**
   1.208 +         * Subinterface links.
   1.209 +         */
   1.210 +        SUBINTERFACES,
   1.211  
   1.212 -    /**
   1.213 -     * The signature in the class documentation (implements/extends portion).
   1.214 -     */
   1.215 -    public static final int CONTEXT_CLASS_SIGNATURE_PARENT_NAME = 24;
   1.216 +        /**
   1.217 +         * Subclasses links.
   1.218 +         */
   1.219 +        SUBCLASSES,
   1.220  
   1.221 -    /**
   1.222 -     * The header for method documentation copied from parent.
   1.223 -     */
   1.224 -    public static final int CONTEXT_METHOD_DOC_COPY = 26;
   1.225 +        /**
   1.226 +         * The signature in the class documentation (implements/extends portion).
   1.227 +         */
   1.228 +        CLASS_SIGNATURE_PARENT_NAME,
   1.229  
   1.230 -    /**
   1.231 -     * Method "specified by" link.
   1.232 -     */
   1.233 -    public static final int CONTEXT_METHOD_SPECIFIED_BY = 27;
   1.234 +        /**
   1.235 +         * The header for method documentation copied from parent.
   1.236 +         */
   1.237 +        METHOD_DOC_COPY,
   1.238  
   1.239 -    /**
   1.240 -     * Method "overrides" link.
   1.241 -     */
   1.242 -    public static final int CONTEXT_METHOD_OVERRIDES = 28;
   1.243 +        /**
   1.244 +         * Method "specified by" link.
   1.245 +         */
   1.246 +        METHOD_SPECIFIED_BY,
   1.247  
   1.248 -    /**
   1.249 -     * Annotation link.
   1.250 -     */
   1.251 -    public static final int CONTEXT_ANNOTATION = 29;
   1.252 +        /**
   1.253 +         * Method "overrides" link.
   1.254 +         */
   1.255 +        METHOD_OVERRIDES,
   1.256  
   1.257 -    /**
   1.258 -     * The header for field documentation copied from parent.
   1.259 -     */
   1.260 -    public static final int CONTEXT_FIELD_DOC_COPY = 30;
   1.261 +        /**
   1.262 +         * Annotation link.
   1.263 +         */
   1.264 +        ANNOTATION,
   1.265  
   1.266 -    /**
   1.267 -     * The parent nodes int the class tree.
   1.268 -     */
   1.269 -    public static final int CONTEXT_CLASS_TREE_PARENT = 31;
   1.270 +        /**
   1.271 +         * The header for field documentation copied from parent.
   1.272 +         */
   1.273 +        FIELD_DOC_COPY,
   1.274  
   1.275 -    /**
   1.276 -     * The type parameters of a method or constructor.
   1.277 -     */
   1.278 -    public static final int CONTEXT_MEMBER_TYPE_PARAMS = 32;
   1.279 +        /**
   1.280 +         * The parent nodes in the class tree.
   1.281 +         */
   1.282 +        CLASS_TREE_PARENT,
   1.283  
   1.284 -    /**
   1.285 -     * Indicate that the link appears in class use documentation.
   1.286 -     */
   1.287 -    public static final int CONTEXT_CLASS_USE_HEADER = 33;
   1.288 +        /**
   1.289 +         * The type parameters of a method or constructor.
   1.290 +         */
   1.291 +        MEMBER_TYPE_PARAMS,
   1.292  
   1.293 -    /**
   1.294 -     * The header for property documentation copied from parent.
   1.295 -     */
   1.296 -    public static final int CONTEXT_PROPERTY_DOC_COPY = 34;
   1.297 +        /**
   1.298 +         * Indicate that the link appears in class use documentation.
   1.299 +         */
   1.300 +        CLASS_USE_HEADER,
   1.301 +
   1.302 +        /**
   1.303 +         * The header for property documentation copied from parent.
   1.304 +         */
   1.305 +        PROPERTY_DOC_COPY
   1.306 +    }
   1.307  
   1.308      public final ConfigurationImpl configuration;
   1.309  
   1.310      /**
   1.311 -     * The integer indicating the location of the link.
   1.312 +     * The location of the link.
   1.313       */
   1.314 -    public int context;
   1.315 +    public Kind context = Kind.DEFAULT;
   1.316  
   1.317      /**
   1.318       * The value of the marker #.
   1.319 @@ -235,7 +239,7 @@
   1.320       * @param target     the value of the target attribute.
   1.321       */
   1.322      public LinkInfoImpl(ConfigurationImpl configuration,
   1.323 -            int context, ClassDoc classDoc, String label, String target) {
   1.324 +            Kind context, ClassDoc classDoc, String label, String target) {
   1.325          this.configuration = configuration;
   1.326          this.classDoc = classDoc;
   1.327          this.label = label;
   1.328 @@ -255,7 +259,7 @@
   1.329       * @param styleName  String style of text defined in style sheet.
   1.330       */
   1.331      public LinkInfoImpl(ConfigurationImpl configuration,
   1.332 -            int context, ClassDoc classDoc, String where, String label,
   1.333 +            Kind context, ClassDoc classDoc, String where, String label,
   1.334              boolean isStrong, String styleName) {
   1.335          this.configuration = configuration;
   1.336          this.classDoc = classDoc;
   1.337 @@ -277,7 +281,7 @@
   1.338       * @param isStrong       true if the link should be strong.
   1.339       */
   1.340      public LinkInfoImpl(ConfigurationImpl configuration,
   1.341 -            int context, ClassDoc classDoc, String where, String label,
   1.342 +            Kind context, ClassDoc classDoc, String where, String label,
   1.343              boolean isStrong) {
   1.344          this.configuration = configuration;
   1.345          this.classDoc = classDoc;
   1.346 @@ -311,7 +315,7 @@
   1.347       * @param isStrong                true if the link should be strong.
   1.348       */
   1.349      public LinkInfoImpl(ConfigurationImpl configuration,
   1.350 -            int context, ExecutableMemberDoc executableMemberDoc,
   1.351 +            Kind context, ExecutableMemberDoc executableMemberDoc,
   1.352              boolean isStrong) {
   1.353          this.configuration = configuration;
   1.354          this.executableMemberDoc = executableMemberDoc;
   1.355 @@ -328,7 +332,7 @@
   1.356       * @param isStrong       true if the link should be strong.
   1.357       */
   1.358      public LinkInfoImpl(ConfigurationImpl configuration,
   1.359 -            int context, ClassDoc classDoc,  boolean isStrong) {
   1.360 +            Kind context, ClassDoc classDoc,  boolean isStrong) {
   1.361          this.configuration = configuration;
   1.362          this.classDoc = classDoc;
   1.363          this.isStrong = isStrong;
   1.364 @@ -343,7 +347,7 @@
   1.365       * @param type       the class to link to.
   1.366       */
   1.367      public LinkInfoImpl(ConfigurationImpl configuration,
   1.368 -            int context, Type type) {
   1.369 +            Kind context, Type type) {
   1.370          this.configuration = configuration;
   1.371          this.type = type;
   1.372          setContext(context);
   1.373 @@ -358,7 +362,7 @@
   1.374       * @param isVarArg   true if this is a link to a var arg.
   1.375       */
   1.376      public LinkInfoImpl(ConfigurationImpl configuration,
   1.377 -            int context, Type type, boolean isVarArg) {
   1.378 +            Kind context, Type type, boolean isVarArg) {
   1.379          this.configuration = configuration;
   1.380          this.type = type;
   1.381          this.isVarArg = isVarArg;
   1.382 @@ -375,7 +379,7 @@
   1.383       * @param isStrong     true if the link should be strong.
   1.384       */
   1.385      public LinkInfoImpl(ConfigurationImpl configuration,
   1.386 -            int context, Type type, String label,
   1.387 +            Kind context, Type type, String label,
   1.388              boolean isStrong) {
   1.389          this.configuration = configuration;
   1.390          this.type = type;
   1.391 @@ -394,7 +398,7 @@
   1.392       * @param isStrong       true if the link should be strong.
   1.393       */
   1.394      public LinkInfoImpl(ConfigurationImpl configuration,
   1.395 -            int context, ClassDoc classDoc, String label,
   1.396 +            Kind context, ClassDoc classDoc, String label,
   1.397              boolean isStrong) {
   1.398          this.configuration = configuration;
   1.399          this.classDoc = classDoc;
   1.400 @@ -406,7 +410,7 @@
   1.401      /**
   1.402       * {@inheritDoc}
   1.403       */
   1.404 -    public int getContext() {
   1.405 +    public Kind getContext() {
   1.406          return context;
   1.407      }
   1.408  
   1.409 @@ -418,56 +422,56 @@
   1.410       *
   1.411       * @param c the context id to set.
   1.412       */
   1.413 -    public void setContext(int c) {
   1.414 +    public final void setContext(Kind c) {
   1.415          //NOTE:  Put context specific link code here.
   1.416          switch (c) {
   1.417              case ALL_CLASSES_FRAME:
   1.418              case PACKAGE_FRAME:
   1.419 -            case CONTEXT_IMPLEMENTED_CLASSES:
   1.420 -            case CONTEXT_SUBCLASSES:
   1.421 -            case CONTEXT_METHOD_DOC_COPY:
   1.422 -            case CONTEXT_FIELD_DOC_COPY:
   1.423 -            case CONTEXT_PROPERTY_DOC_COPY:
   1.424 -            case CONTEXT_CLASS_USE_HEADER:
   1.425 +            case IMPLEMENTED_CLASSES:
   1.426 +            case SUBCLASSES:
   1.427 +            case METHOD_DOC_COPY:
   1.428 +            case FIELD_DOC_COPY:
   1.429 +            case PROPERTY_DOC_COPY:
   1.430 +            case CLASS_USE_HEADER:
   1.431                  includeTypeInClassLinkLabel = false;
   1.432                  break;
   1.433  
   1.434 -            case CONTEXT_ANNOTATION:
   1.435 +            case ANNOTATION:
   1.436                  excludeTypeParameterLinks = true;
   1.437                  excludeTypeBounds = true;
   1.438                  break;
   1.439  
   1.440 -            case CONTEXT_IMPLEMENTED_INTERFACES:
   1.441 -            case CONTEXT_SUPER_INTERFACES:
   1.442 -            case CONTEXT_SUBINTERFACES:
   1.443 -            case CONTEXT_CLASS_TREE_PARENT:
   1.444 -            case CONTEXT_TREE:
   1.445 -            case CONTEXT_CLASS_SIGNATURE_PARENT_NAME:
   1.446 +            case IMPLEMENTED_INTERFACES:
   1.447 +            case SUPER_INTERFACES:
   1.448 +            case SUBINTERFACES:
   1.449 +            case CLASS_TREE_PARENT:
   1.450 +            case TREE:
   1.451 +            case CLASS_SIGNATURE_PARENT_NAME:
   1.452                  excludeTypeParameterLinks = true;
   1.453                  excludeTypeBounds = true;
   1.454                  includeTypeInClassLinkLabel = false;
   1.455                  includeTypeAsSepLink = true;
   1.456                  break;
   1.457  
   1.458 -            case CONTEXT_PACKAGE:
   1.459 -            case CONTEXT_CLASS_USE:
   1.460 -            case CONTEXT_CLASS_HEADER:
   1.461 -            case CONTEXT_CLASS_SIGNATURE:
   1.462 +            case PACKAGE:
   1.463 +            case CLASS_USE:
   1.464 +            case CLASS_HEADER:
   1.465 +            case CLASS_SIGNATURE:
   1.466                  excludeTypeParameterLinks = true;
   1.467                  includeTypeAsSepLink = true;
   1.468                  includeTypeInClassLinkLabel = false;
   1.469                  break;
   1.470  
   1.471 -            case CONTEXT_MEMBER_TYPE_PARAMS:
   1.472 +            case MEMBER_TYPE_PARAMS:
   1.473                  includeTypeAsSepLink = true;
   1.474                  includeTypeInClassLinkLabel = false;
   1.475                  break;
   1.476  
   1.477 -            case CONTEXT_RETURN_TYPE:
   1.478 -            case CONTEXT_SUMMARY_RETURN_TYPE:
   1.479 +            case RETURN_TYPE:
   1.480 +            case SUMMARY_RETURN_TYPE:
   1.481                  excludeTypeBounds = true;
   1.482                  break;
   1.483 -            case CONTEXT_EXECUTABLE_MEMBER_PARAM:
   1.484 +            case EXECUTABLE_MEMBER_PARAM:
   1.485                  excludeTypeBounds = true;
   1.486                  break;
   1.487          }

mercurial