src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java

changeset 1750
081d7c72ee92
parent 1749
25c89a492f14
child 1866
26437287529d
equal deleted inserted replaced
1749:25c89a492f14 1750:081d7c72ee92
181 this.nosince = nosince; 181 this.nosince = nosince;
182 this.showversion = showversion; 182 this.showversion = showversion;
183 this.showauthor = showauthor; 183 this.showauthor = showauthor;
184 this.javafx = javafx; 184 this.javafx = javafx;
185 this.message = message; 185 this.message = message;
186 initStandardTags(); 186 initStandardTaglets();
187 initStandardTagsLowercase(); 187 initStandardTagsLowercase();
188 } 188 }
189 189
190 /** 190 /**
191 * Add a new <code>CustomTag</code>. This is used to add a Taglet from within 191 * Add a new <code>CustomTag</code>. This is used to add a Taglet from within
451 * Return the array of <code>Taglet</code>s that can 451 * Return the array of <code>Taglet</code>s that can
452 * appear in packages. 452 * appear in packages.
453 * @return the array of <code>Taglet</code>s that can 453 * @return the array of <code>Taglet</code>s that can
454 * appear in packages. 454 * appear in packages.
455 */ 455 */
456 public Taglet[] getPackageCustomTags() { 456 public Taglet[] getPackageCustomTaglets() {
457 if (packageTags == null) { 457 if (packageTags == null) {
458 initCustomTagArrays(); 458 initCustomTagletArrays();
459 } 459 }
460 return packageTags; 460 return packageTags;
461 } 461 }
462 462
463 /** 463 /**
464 * Return the array of <code>Taglet</code>s that can 464 * Return the array of <code>Taglet</code>s that can
465 * appear in classes or interfaces. 465 * appear in classes or interfaces.
466 * @return the array of <code>Taglet</code>s that can 466 * @return the array of <code>Taglet</code>s that can
467 * appear in classes or interfaces. 467 * appear in classes or interfaces.
468 */ 468 */
469 public Taglet[] getTypeCustomTags() { 469 public Taglet[] getTypeCustomTaglets() {
470 if (typeTags == null) { 470 if (typeTags == null) {
471 initCustomTagArrays(); 471 initCustomTagletArrays();
472 } 472 }
473 return typeTags; 473 return typeTags;
474 } 474 }
475 475
476 /** 476 /**
477 * Return the array of inline <code>Taglet</code>s that can 477 * Return the array of inline <code>Taglet</code>s that can
478 * appear in comments. 478 * appear in comments.
479 * @return the array of <code>Taglet</code>s that can 479 * @return the array of <code>Taglet</code>s that can
480 * appear in comments. 480 * appear in comments.
481 */ 481 */
482 public Taglet[] getInlineCustomTags() { 482 public Taglet[] getInlineCustomTaglets() {
483 if (inlineTags == null) { 483 if (inlineTags == null) {
484 initCustomTagArrays(); 484 initCustomTagletArrays();
485 } 485 }
486 return inlineTags; 486 return inlineTags;
487 } 487 }
488 488
489 /** 489 /**
490 * Return the array of <code>Taglet</code>s that can 490 * Return the array of <code>Taglet</code>s that can
491 * appear in fields. 491 * appear in fields.
492 * @return the array of <code>Taglet</code>s that can 492 * @return the array of <code>Taglet</code>s that can
493 * appear in field. 493 * appear in field.
494 */ 494 */
495 public Taglet[] getFieldCustomTags() { 495 public Taglet[] getFieldCustomTaglets() {
496 if (fieldTags == null) { 496 if (fieldTags == null) {
497 initCustomTagArrays(); 497 initCustomTagletArrays();
498 } 498 }
499 return fieldTags; 499 return fieldTags;
500 } 500 }
501 501
502 /** 502 /**
503 * Return the array of <code>Taglet</code>s that can 503 * Return the array of <code>Taglet</code>s that can
504 * appear in the serialized form. 504 * appear in the serialized form.
505 * @return the array of <code>Taglet</code>s that can 505 * @return the array of <code>Taglet</code>s that can
506 * appear in the serialized form. 506 * appear in the serialized form.
507 */ 507 */
508 public Taglet[] getSerializedFormTags() { 508 public Taglet[] getSerializedFormTaglets() {
509 if (serializedFormTags == null) { 509 if (serializedFormTags == null) {
510 initCustomTagArrays(); 510 initCustomTagletArrays();
511 } 511 }
512 return serializedFormTags; 512 return serializedFormTags;
513 } 513 }
514 514
515 /** 515 /**
516 * @return the array of <code>Taglet</code>s that can 516 * @return the array of <code>Taglet</code>s that can
517 * appear in the given Doc. 517 * appear in the given Doc.
518 */ 518 */
519 public Taglet[] getCustomTags(Doc doc) { 519 public Taglet[] getCustomTaglets(Doc doc) {
520 if (doc instanceof ConstructorDoc) { 520 if (doc instanceof ConstructorDoc) {
521 return getConstructorCustomTags(); 521 return getConstructorCustomTaglets();
522 } else if (doc instanceof MethodDoc) { 522 } else if (doc instanceof MethodDoc) {
523 return getMethodCustomTags(); 523 return getMethodCustomTaglets();
524 } else if (doc instanceof FieldDoc) { 524 } else if (doc instanceof FieldDoc) {
525 return getFieldCustomTags(); 525 return getFieldCustomTaglets();
526 } else if (doc instanceof ClassDoc) { 526 } else if (doc instanceof ClassDoc) {
527 return getTypeCustomTags(); 527 return getTypeCustomTaglets();
528 } else if (doc instanceof PackageDoc) { 528 } else if (doc instanceof PackageDoc) {
529 return getPackageCustomTags(); 529 return getPackageCustomTaglets();
530 } else if (doc instanceof RootDoc) { 530 } else if (doc instanceof RootDoc) {
531 return getOverviewCustomTags(); 531 return getOverviewCustomTaglets();
532 } 532 }
533 return null; 533 return null;
534 } 534 }
535 535
536 /** 536 /**
537 * Return the array of <code>Taglet</code>s that can 537 * Return the array of <code>Taglet</code>s that can
538 * appear in constructors. 538 * appear in constructors.
539 * @return the array of <code>Taglet</code>s that can 539 * @return the array of <code>Taglet</code>s that can
540 * appear in constructors. 540 * appear in constructors.
541 */ 541 */
542 public Taglet[] getConstructorCustomTags() { 542 public Taglet[] getConstructorCustomTaglets() {
543 if (constructorTags == null) { 543 if (constructorTags == null) {
544 initCustomTagArrays(); 544 initCustomTagletArrays();
545 } 545 }
546 return constructorTags; 546 return constructorTags;
547 } 547 }
548 548
549 /** 549 /**
550 * Return the array of <code>Taglet</code>s that can 550 * Return the array of <code>Taglet</code>s that can
551 * appear in methods. 551 * appear in methods.
552 * @return the array of <code>Taglet</code>s that can 552 * @return the array of <code>Taglet</code>s that can
553 * appear in methods. 553 * appear in methods.
554 */ 554 */
555 public Taglet[] getMethodCustomTags() { 555 public Taglet[] getMethodCustomTaglets() {
556 if (methodTags == null) { 556 if (methodTags == null) {
557 initCustomTagArrays(); 557 initCustomTagletArrays();
558 } 558 }
559 return methodTags; 559 return methodTags;
560 } 560 }
561 561
562 /** 562 /**
563 * Return the array of <code>Taglet</code>s that can 563 * Return the array of <code>Taglet</code>s that can
564 * appear in an overview. 564 * appear in an overview.
565 * @return the array of <code>Taglet</code>s that can 565 * @return the array of <code>Taglet</code>s that can
566 * appear in overview. 566 * appear in overview.
567 */ 567 */
568 public Taglet[] getOverviewCustomTags() { 568 public Taglet[] getOverviewCustomTaglets() {
569 if (overviewTags == null) { 569 if (overviewTags == null) {
570 initCustomTagArrays(); 570 initCustomTagletArrays();
571 } 571 }
572 return overviewTags; 572 return overviewTags;
573 } 573 }
574 574
575 /** 575 /**
576 * Initialize the custom tag arrays. 576 * Initialize the custom tag arrays.
577 */ 577 */
578 private void initCustomTagArrays() { 578 private void initCustomTagletArrays() {
579 Iterator<Taglet> it = customTags.values().iterator(); 579 Iterator<Taglet> it = customTags.values().iterator();
580 ArrayList<Taglet> pTags = new ArrayList<Taglet>(customTags.size()); 580 ArrayList<Taglet> pTags = new ArrayList<Taglet>(customTags.size());
581 ArrayList<Taglet> tTags = new ArrayList<Taglet>(customTags.size()); 581 ArrayList<Taglet> tTags = new ArrayList<Taglet>(customTags.size());
582 ArrayList<Taglet> fTags = new ArrayList<Taglet>(customTags.size()); 582 ArrayList<Taglet> fTags = new ArrayList<Taglet>(customTags.size());
583 ArrayList<Taglet> cTags = new ArrayList<Taglet>(customTags.size()); 583 ArrayList<Taglet> cTags = new ArrayList<Taglet>(customTags.size());
628 } 628 }
629 629
630 /** 630 /**
631 * Initialize standard Javadoc tags for ordering purposes. 631 * Initialize standard Javadoc tags for ordering purposes.
632 */ 632 */
633 private void initStandardTags() { 633 private void initStandardTaglets() {
634 Taglet temp; 634 Taglet temp;
635 customTags.put((temp = new ParamTaglet()).getName(), temp); 635 addStandardTaglet(new ParamTaglet());
636 customTags.put((temp = new ReturnTaglet()).getName(), temp); 636 addStandardTaglet(new ReturnTaglet());
637 customTags.put((temp = new ThrowsTaglet()).getName(), temp); 637 addStandardTaglet(new ThrowsTaglet());
638 customTags.put((temp = new SimpleTaglet("exception", 638 addStandardTaglet(new SimpleTaglet("exception", null,
639 null, SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR)).getName(), temp); 639 SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR));
640 if (!nosince) { 640 addStandardTaglet(!nosince, new SimpleTaglet("since", message.getText("doclet.Since"),
641 customTags.put((temp = new SimpleTaglet("since", message.getText("doclet.Since"), 641 SimpleTaglet.ALL));
642 SimpleTaglet.ALL)).getName(), temp); 642 addStandardTaglet(showversion, new SimpleTaglet("version", message.getText("doclet.Version"),
643 } 643 SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
644 if (showversion) { 644 addStandardTaglet(showauthor, new SimpleTaglet("author", message.getText("doclet.Author"),
645 customTags.put((temp = new SimpleTaglet("version", message.getText("doclet.Version"), 645 SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
646 SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)).getName(), temp); 646 addStandardTaglet(new SimpleTaglet("serialData", message.getText("doclet.SerialData"),
647 } 647 SimpleTaglet.EXCLUDED));
648 if (showauthor) {
649 customTags.put((temp = new SimpleTaglet("author", message.getText("doclet.Author"),
650 SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)).getName(), temp);
651 }
652 customTags.put((temp = new SimpleTaglet("serialData", message.getText("doclet.SerialData"),
653 SimpleTaglet.EXCLUDED)).getName(), temp);
654 customTags.put((temp = new SimpleTaglet("factory", message.getText("doclet.Factory"), 648 customTags.put((temp = new SimpleTaglet("factory", message.getText("doclet.Factory"),
655 SimpleTaglet.METHOD)).getName(), temp); 649 SimpleTaglet.METHOD)).getName(), temp);
656 customTags.put((temp = new SeeTaglet()).getName(), temp); 650 addStandardTaglet(new SeeTaglet());
657 //Standard inline tags 651 //Standard inline tags
658 customTags.put((temp = new DocRootTaglet()).getName(), temp); 652 addStandardTaglet(new DocRootTaglet());
659 customTags.put((temp = new InheritDocTaglet()).getName(), temp); 653 addStandardTaglet(new InheritDocTaglet());
660 customTags.put((temp = new ValueTaglet()).getName(), temp); 654 addStandardTaglet(new ValueTaglet());
661 customTags.put((temp = new LiteralTaglet()).getName(), temp); 655 addStandardTaglet(new LiteralTaglet());
662 customTags.put((temp = new CodeTaglet()).getName(), temp); 656 addStandardTaglet(new CodeTaglet());
663 657
664 //Keep track of the names of standard tags for error 658 // Keep track of the names of standard tags for error
665 //checking purposes. 659 // checking purposes. The following are not handled above.
666 standardTags.add("param"); 660 // See, for example, com.sun.tools.javadoc.Comment
667 standardTags.add("return");
668 standardTags.add("throws");
669 standardTags.add("exception");
670 standardTags.add("since");
671 standardTags.add("version");
672 standardTags.add("author");
673 standardTags.add("see");
674 standardTags.add("deprecated"); 661 standardTags.add("deprecated");
675 standardTags.add("link"); 662 standardTags.add("link");
676 standardTags.add("linkplain"); 663 standardTags.add("linkplain");
677 standardTags.add("inheritDoc");
678 standardTags.add("docRoot");
679 standardTags.add("value");
680 standardTags.add("serial"); 664 standardTags.add("serial");
681 standardTags.add("serialData");
682 standardTags.add("serialField"); 665 standardTags.add("serialField");
683 standardTags.add("Text"); 666 standardTags.add("Text");
684 standardTags.add("literal");
685 standardTags.add("code");
686 667
687 if (javafx) { 668 if (javafx) {
688 initJavaFXTags(); 669 initJavaFXTaglets();
689 } 670 }
690 } 671 }
691 672
692 /** 673 /**
693 * Initialize JavaFX-related tags. 674 * Initialize JavaFX-related tags.
694 */ 675 */
695 private void initJavaFXTags() { 676 private void initJavaFXTaglets() {
696 Taglet temp; 677 addStandardTaglet(new PropertyGetterTaglet());
697 customTags.put((temp = new PropertyGetterTaglet()).getName(), temp); 678 addStandardTaglet(new PropertySetterTaglet());
698 customTags.put((temp = new PropertySetterTaglet()).getName(), temp); 679 addStandardTaglet(new SimpleTaglet("propertyDescription",
699 customTags.put((temp = new SimpleTaglet("propertyDescription", message.getText("doclet.PropertyDescription"), 680 message.getText("doclet.PropertyDescription"),
700 SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp); 681 SimpleTaglet.FIELD + SimpleTaglet.METHOD));
701 customTags.put((temp = new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"), 682 addStandardTaglet(new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
702 SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp); 683 SimpleTaglet.FIELD + SimpleTaglet.METHOD));
703 customTags.put((temp = new SimpleTaglet("treatAsPrivate", null, 684 addStandardTaglet(new SimpleTaglet("treatAsPrivate", null,
704 SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)).getName(), temp); 685 SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE));
705 686 }
706 standardTags.add("propertyGetter"); 687
707 standardTags.add("propertySetter"); 688 void addStandardTaglet(Taglet taglet) {
708 standardTags.add("propertyDescription"); 689 String name = taglet.getName();
709 standardTags.add("defaultValue"); 690 customTags.put(name, taglet);
710 standardTags.add("treatAsPrivate"); 691 standardTags.add(name);
692 }
693
694 void addStandardTaglet(boolean enable, Taglet taglet) {
695 String name = taglet.getName();
696 if (enable)
697 customTags.put(name, taglet);
698 standardTags.add(name);
711 } 699 }
712 700
713 /** 701 /**
714 * Initialize lowercase version of standard Javadoc tags. 702 * Initialize lowercase version of standard Javadoc tags.
715 */ 703 */

mercurial