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

Thu, 15 Nov 2012 09:18:36 -0800

author
jjg
date
Thu, 15 Nov 2012 09:18:36 -0800
changeset 1410
bfec2a1cc869
parent 1359
25e14ad23cef
child 1521
71f35e4b93a5
permissions
-rw-r--r--

8000800: javadoc uses static non-final fields
Reviewed-by: bpatel

duke@1 1 /*
jjg@1359 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26
duke@1 27 package com.sun.tools.doclets.formats.html;
duke@1 28
duke@1 29 import com.sun.javadoc.*;
duke@1 30 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 31 import com.sun.tools.doclets.internal.toolkit.util.links.*;
duke@1 32
jjg@1359 33 /**
jjg@1359 34 * <p><b>This is NOT part of any supported API.
jjg@1359 35 * If you write code that depends on this, you do so at your own risk.
jjg@1359 36 * This code and its internal interfaces are subject to change or
jjg@1359 37 * deletion without notice.</b>
jjg@1359 38 */
duke@1 39 public class LinkInfoImpl extends LinkInfo {
duke@1 40
duke@1 41 /**
duke@1 42 * Indicate that the link appears in a class list.
duke@1 43 */
duke@1 44 public static final int ALL_CLASSES_FRAME = 1;
duke@1 45
duke@1 46 /**
duke@1 47 * Indicate that the link appears in a class documentation.
duke@1 48 */
duke@1 49 public static final int CONTEXT_CLASS = 2;
duke@1 50
duke@1 51 /**
duke@1 52 * Indicate that the link appears in member documentation.
duke@1 53 */
duke@1 54 public static final int CONTEXT_MEMBER = 3;
duke@1 55
duke@1 56 /**
duke@1 57 * Indicate that the link appears in class use documentation.
duke@1 58 */
duke@1 59 public static final int CONTEXT_CLASS_USE = 4;
duke@1 60
duke@1 61 /**
duke@1 62 * Indicate that the link appears in index documentation.
duke@1 63 */
duke@1 64 public static final int CONTEXT_INDEX = 5;
duke@1 65
duke@1 66 /**
duke@1 67 * Indicate that the link appears in constant value summary.
duke@1 68 */
duke@1 69 public static final int CONTEXT_CONSTANT_SUMMARY = 6;
duke@1 70
duke@1 71 /**
duke@1 72 * Indicate that the link appears in serialized form documentation.
duke@1 73 */
duke@1 74 public static final int CONTEXT_SERIALIZED_FORM = 7;
duke@1 75
duke@1 76 /**
duke@1 77 * Indicate that the link appears in serial member documentation.
duke@1 78 */
duke@1 79 public static final int CONTEXT_SERIAL_MEMBER = 8;
duke@1 80
duke@1 81 /**
duke@1 82 * Indicate that the link appears in package documentation.
duke@1 83 */
duke@1 84 public static final int CONTEXT_PACKAGE = 9;
duke@1 85
duke@1 86 /**
duke@1 87 * Indicate that the link appears in see tag documentation.
duke@1 88 */
duke@1 89 public static final int CONTEXT_SEE_TAG = 10;
duke@1 90
duke@1 91 /**
duke@1 92 * Indicate that the link appears in value tag documentation.
duke@1 93 */
duke@1 94 public static final int CONTEXT_VALUE_TAG = 11;
duke@1 95
duke@1 96 /**
duke@1 97 * Indicate that the link appears in tree documentation.
duke@1 98 */
duke@1 99 public static final int CONTEXT_TREE = 12;
duke@1 100
duke@1 101 /**
duke@1 102 * Indicate that the link appears in a class list.
duke@1 103 */
duke@1 104 public static final int PACKAGE_FRAME = 13;
duke@1 105
duke@1 106 /**
duke@1 107 * The header in the class documentation.
duke@1 108 */
duke@1 109 public static final int CONTEXT_CLASS_HEADER = 14;
duke@1 110
duke@1 111 /**
duke@1 112 * The signature in the class documentation.
duke@1 113 */
duke@1 114 public static final int CONTEXT_CLASS_SIGNATURE = 15;
duke@1 115
duke@1 116 /**
duke@1 117 * The return type of a method.
duke@1 118 */
duke@1 119 public static final int CONTEXT_RETURN_TYPE = 16;
duke@1 120
duke@1 121 /**
duke@1 122 * The return type of a method in a member summary.
duke@1 123 */
duke@1 124 public static final int CONTEXT_SUMMARY_RETURN_TYPE = 17;
duke@1 125
duke@1 126 /**
duke@1 127 * The type of a method/constructor parameter.
duke@1 128 */
duke@1 129 public static final int CONTEXT_EXECUTABLE_MEMBER_PARAM = 18;
duke@1 130
duke@1 131 /**
duke@1 132 * Super interface links.
duke@1 133 */
duke@1 134 public static final int CONTEXT_SUPER_INTERFACES = 19;
duke@1 135
duke@1 136 /**
duke@1 137 * Implemented interface links.
duke@1 138 */
duke@1 139 public static final int CONTEXT_IMPLEMENTED_INTERFACES = 20;
duke@1 140
duke@1 141 /**
duke@1 142 * Implemented class links.
duke@1 143 */
duke@1 144 public static final int CONTEXT_IMPLEMENTED_CLASSES = 21;
duke@1 145
duke@1 146 /**
duke@1 147 * Subinterface links.
duke@1 148 */
duke@1 149 public static final int CONTEXT_SUBINTERFACES = 22;
duke@1 150
duke@1 151 /**
duke@1 152 * Subclasses links.
duke@1 153 */
duke@1 154 public static final int CONTEXT_SUBCLASSES = 23;
duke@1 155
duke@1 156 /**
duke@1 157 * The signature in the class documentation (implements/extends portion).
duke@1 158 */
duke@1 159 public static final int CONTEXT_CLASS_SIGNATURE_PARENT_NAME = 24;
duke@1 160
duke@1 161 /**
duke@1 162 * The header for method documentation copied from parent.
duke@1 163 */
duke@1 164 public static final int CONTEXT_METHOD_DOC_COPY = 26;
duke@1 165
duke@1 166 /**
duke@1 167 * Method "specified by" link.
duke@1 168 */
duke@1 169 public static final int CONTEXT_METHOD_SPECIFIED_BY = 27;
duke@1 170
duke@1 171 /**
duke@1 172 * Method "overrides" link.
duke@1 173 */
duke@1 174 public static final int CONTEXT_METHOD_OVERRIDES = 28;
duke@1 175
duke@1 176 /**
duke@1 177 * Annotation link.
duke@1 178 */
duke@1 179 public static final int CONTEXT_ANNOTATION = 29;
duke@1 180
duke@1 181 /**
duke@1 182 * The header for field documentation copied from parent.
duke@1 183 */
duke@1 184 public static final int CONTEXT_FIELD_DOC_COPY = 30;
duke@1 185
duke@1 186 /**
duke@1 187 * The parent nodes int the class tree.
duke@1 188 */
duke@1 189 public static final int CONTEXT_CLASS_TREE_PARENT = 31;
duke@1 190
duke@1 191 /**
duke@1 192 * The type parameters of a method or constructor.
duke@1 193 */
duke@1 194 public static final int CONTEXT_MEMBER_TYPE_PARAMS = 32;
duke@1 195
duke@1 196 /**
duke@1 197 * Indicate that the link appears in class use documentation.
duke@1 198 */
duke@1 199 public static final int CONTEXT_CLASS_USE_HEADER = 33;
duke@1 200
jjg@1410 201 public final ConfigurationImpl configuration;
jjg@1410 202
duke@1 203 /**
duke@1 204 * The integer indicating the location of the link.
duke@1 205 */
duke@1 206 public int context;
duke@1 207
duke@1 208 /**
duke@1 209 * The value of the marker #.
duke@1 210 */
duke@1 211 public String where = "";
duke@1 212
duke@1 213 /**
duke@1 214 * String style of text defined in style sheet.
duke@1 215 */
duke@1 216 public String styleName ="";
duke@1 217
duke@1 218 /**
jjg@1410 219 * The value of the target.
duke@1 220 */
duke@1 221 public String target = "";
duke@1 222
duke@1 223 /**
duke@1 224 * Construct a LinkInfo object.
duke@1 225 *
jjg@1410 226 * @param configuration the configuration data for the doclet
duke@1 227 * @param context the context of the link.
duke@1 228 * @param classDoc the class to link to.
duke@1 229 * @param label the label for the link.
duke@1 230 * @param target the value of the target attribute.
duke@1 231 */
jjg@1410 232 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 233 int context, ClassDoc classDoc, String label, String target) {
jjg@1410 234 this.configuration = configuration;
duke@1 235 this.classDoc = classDoc;
duke@1 236 this.label = label;
duke@1 237 this.target = target;
duke@1 238 setContext(context);
duke@1 239 }
duke@1 240
duke@1 241 /**
duke@1 242 * Construct a LinkInfo object.
duke@1 243 *
jjg@1410 244 * @param configuration the configuration data for the doclet
duke@1 245 * @param context the context of the link.
duke@1 246 * @param classDoc the class to link to.
duke@1 247 * @param where the value of the marker #.
duke@1 248 * @param label the label for the link.
bpatel@182 249 * @param isStrong true if the link should be strong.
duke@1 250 * @param styleName String style of text defined in style sheet.
duke@1 251 */
jjg@1410 252 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 253 int context, ClassDoc classDoc, String where, String label,
jjg@1410 254 boolean isStrong, String styleName) {
jjg@1410 255 this.configuration = configuration;
duke@1 256 this.classDoc = classDoc;
duke@1 257 this.where = where;
duke@1 258 this.label = label;
bpatel@182 259 this.isStrong = isStrong;
duke@1 260 this.styleName = styleName;
duke@1 261 setContext(context);
duke@1 262 }
duke@1 263
duke@1 264 /**
duke@1 265 * Construct a LinkInfo object.
duke@1 266 *
jjg@1410 267 * @param configuration the configuration data for the doclet
duke@1 268 * @param context the context of the link.
duke@1 269 * @param classDoc the class to link to.
duke@1 270 * @param where the value of the marker #.
duke@1 271 * @param label the label for the link.
bpatel@182 272 * @param isStrong true if the link should be strong.
duke@1 273 */
jjg@1410 274 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 275 int context, ClassDoc classDoc, String where, String label,
jjg@1410 276 boolean isStrong) {
jjg@1410 277 this.configuration = configuration;
duke@1 278 this.classDoc = classDoc;
duke@1 279 this.where = where;
duke@1 280 this.label = label;
bpatel@182 281 this.isStrong = isStrong;
duke@1 282 setContext(context);
duke@1 283 }
duke@1 284
duke@1 285 /**
duke@1 286 * Construct a LinkInfo object.
duke@1 287 *
jjg@1410 288 * @param configuration the configuration data for the doclet
duke@1 289 * @param classDoc the class to link to.
duke@1 290 * @param label the label for the link.
duke@1 291 */
jjg@1410 292 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 293 ClassDoc classDoc, String label) {
jjg@1410 294 this.configuration = configuration;
duke@1 295 this.classDoc = classDoc;
duke@1 296 this.label = label;
duke@1 297 setContext(context);
duke@1 298 }
duke@1 299
duke@1 300 /**
duke@1 301 * Construct a LinkInfo object.
duke@1 302 *
jjg@1410 303 * @param configuration the configuration data for the doclet
duke@1 304 * @param context the context of the link.
duke@1 305 * @param executableMemberDoc the member to link to.
bpatel@182 306 * @param isStrong true if the link should be strong.
duke@1 307 */
jjg@1410 308 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 309 int context, ExecutableMemberDoc executableMemberDoc,
jjg@1410 310 boolean isStrong) {
jjg@1410 311 this.configuration = configuration;
duke@1 312 this.executableMemberDoc = executableMemberDoc;
bpatel@182 313 this.isStrong = isStrong;
duke@1 314 setContext(context);
duke@1 315 }
duke@1 316
duke@1 317 /**
duke@1 318 * Construct a LinkInfo object.
duke@1 319 *
jjg@1410 320 * @param configuration the configuration data for the doclet
duke@1 321 * @param context the context of the link.
duke@1 322 * @param classDoc the class to link to.
bpatel@182 323 * @param isStrong true if the link should be strong.
duke@1 324 */
jjg@1410 325 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 326 int context, ClassDoc classDoc, boolean isStrong) {
jjg@1410 327 this.configuration = configuration;
duke@1 328 this.classDoc = classDoc;
bpatel@182 329 this.isStrong = isStrong;
duke@1 330 setContext(context);
duke@1 331 }
duke@1 332
duke@1 333 /**
duke@1 334 * Construct a LinkInfo object.
duke@1 335 *
jjg@1410 336 * @param configuration the configuration data for the doclet
duke@1 337 * @param context the context of the link.
duke@1 338 * @param type the class to link to.
duke@1 339 */
jjg@1410 340 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 341 int context, Type type) {
jjg@1410 342 this.configuration = configuration;
duke@1 343 this.type = type;
duke@1 344 setContext(context);
duke@1 345 }
duke@1 346
duke@1 347 /**
duke@1 348 * Construct a LinkInfo object.
duke@1 349 *
jjg@1410 350 * @param configuration the configuration data for the doclet
duke@1 351 * @param context the context of the link.
duke@1 352 * @param type the class to link to.
duke@1 353 * @param isVarArg true if this is a link to a var arg.
duke@1 354 */
jjg@1410 355 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 356 int context, Type type, boolean isVarArg) {
jjg@1410 357 this.configuration = configuration;
duke@1 358 this.type = type;
duke@1 359 this.isVarArg = isVarArg;
duke@1 360 setContext(context);
duke@1 361 }
duke@1 362
duke@1 363 /**
duke@1 364 * Construct a LinkInfo object.
duke@1 365 *
jjg@1410 366 * @param configuration the configuration data for the doclet
duke@1 367 * @param context the context of the link.
duke@1 368 * @param type the class to link to.
duke@1 369 * @param label the label for the link.
bpatel@182 370 * @param isStrong true if the link should be strong.
duke@1 371 */
jjg@1410 372 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 373 int context, Type type, String label,
jjg@1410 374 boolean isStrong) {
jjg@1410 375 this.configuration = configuration;
duke@1 376 this.type = type;
duke@1 377 this.label = label;
bpatel@182 378 this.isStrong = isStrong;
duke@1 379 setContext(context);
duke@1 380 }
duke@1 381
duke@1 382 /**
duke@1 383 * Construct a LinkInfo object.
duke@1 384 *
jjg@1410 385 * @param configuration the configuration data for the doclet
duke@1 386 * @param context the context of the link.
duke@1 387 * @param classDoc the class to link to.
duke@1 388 * @param label the label for the link.
bpatel@182 389 * @param isStrong true if the link should be strong.
duke@1 390 */
jjg@1410 391 public LinkInfoImpl(ConfigurationImpl configuration,
jjg@1410 392 int context, ClassDoc classDoc, String label,
jjg@1410 393 boolean isStrong) {
jjg@1410 394 this.configuration = configuration;
duke@1 395 this.classDoc = classDoc;
duke@1 396 this.label = label;
bpatel@182 397 this.isStrong = isStrong;
duke@1 398 setContext(context);
duke@1 399 }
duke@1 400
duke@1 401 /**
duke@1 402 * {@inheritDoc}
duke@1 403 */
duke@1 404 public int getContext() {
duke@1 405 return context;
duke@1 406 }
duke@1 407
duke@1 408 /**
duke@1 409 * {@inheritDoc}
duke@1 410 *
duke@1 411 * This method sets the link attributes to the appropriate values
duke@1 412 * based on the context.
duke@1 413 *
duke@1 414 * @param c the context id to set.
duke@1 415 */
duke@1 416 public void setContext(int c) {
duke@1 417 //NOTE: Put context specific link code here.
duke@1 418 switch (c) {
duke@1 419 case ALL_CLASSES_FRAME:
duke@1 420 case PACKAGE_FRAME:
duke@1 421 case CONTEXT_IMPLEMENTED_CLASSES:
duke@1 422 case CONTEXT_SUBCLASSES:
duke@1 423 case CONTEXT_METHOD_DOC_COPY:
duke@1 424 case CONTEXT_FIELD_DOC_COPY:
duke@1 425 case CONTEXT_CLASS_USE_HEADER:
duke@1 426 includeTypeInClassLinkLabel = false;
duke@1 427 break;
duke@1 428
duke@1 429 case CONTEXT_ANNOTATION:
duke@1 430 excludeTypeParameterLinks = true;
duke@1 431 excludeTypeBounds = true;
duke@1 432 break;
duke@1 433
duke@1 434 case CONTEXT_IMPLEMENTED_INTERFACES:
duke@1 435 case CONTEXT_SUPER_INTERFACES:
duke@1 436 case CONTEXT_SUBINTERFACES:
duke@1 437 case CONTEXT_CLASS_TREE_PARENT:
duke@1 438 case CONTEXT_TREE:
duke@1 439 case CONTEXT_CLASS_SIGNATURE_PARENT_NAME:
duke@1 440 excludeTypeParameterLinks = true;
duke@1 441 excludeTypeBounds = true;
duke@1 442 includeTypeInClassLinkLabel = false;
duke@1 443 includeTypeAsSepLink = true;
duke@1 444 break;
duke@1 445
duke@1 446 case CONTEXT_PACKAGE:
duke@1 447 case CONTEXT_CLASS_USE:
duke@1 448 case CONTEXT_CLASS_HEADER:
duke@1 449 case CONTEXT_CLASS_SIGNATURE:
duke@1 450 excludeTypeParameterLinks = true;
duke@1 451 includeTypeAsSepLink = true;
duke@1 452 includeTypeInClassLinkLabel = false;
duke@1 453 break;
duke@1 454
duke@1 455 case CONTEXT_MEMBER_TYPE_PARAMS:
duke@1 456 includeTypeAsSepLink = true;
duke@1 457 includeTypeInClassLinkLabel = false;
duke@1 458 break;
duke@1 459
duke@1 460 case CONTEXT_RETURN_TYPE:
duke@1 461 case CONTEXT_SUMMARY_RETURN_TYPE:
duke@1 462 case CONTEXT_EXECUTABLE_MEMBER_PARAM:
duke@1 463 excludeTypeBounds = true;
duke@1 464 break;
duke@1 465 }
duke@1 466 context = c;
duke@1 467 if (type != null &&
duke@1 468 type.asTypeVariable()!= null &&
duke@1 469 type.asTypeVariable().owner() instanceof ExecutableMemberDoc){
duke@1 470 excludeTypeParameterLinks = true;
duke@1 471 }
duke@1 472 }
duke@1 473
duke@1 474 /**
duke@1 475 * Return true if this link is linkable and false if we can't link to the
duke@1 476 * desired place.
duke@1 477 *
duke@1 478 * @return true if this link is linkable and false if we can't link to the
duke@1 479 * desired place.
duke@1 480 */
duke@1 481 public boolean isLinkable() {
jjg@1410 482 return Util.isLinkable(classDoc, configuration);
duke@1 483 }
duke@1 484 }

mercurial