< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java

Print this page




 211     protected TypeElement getCurrentPageElement() {
 212         return typeElement;
 213     }
 214 
 215     /**
 216      * {@inheritDoc}
 217      */
 218     @Override @SuppressWarnings("preview")
 219     public void addClassSignature(String modifiers, Content classInfoTree) {
 220         Content hr = new HtmlTree(HtmlTag.HR);
 221         classInfoTree.add(hr);
 222         Content pre = new HtmlTree(HtmlTag.PRE);
 223         addAnnotationInfo(typeElement, pre);
 224         pre.add(modifiers);
 225         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
 226                 LinkInfoImpl.Kind.CLASS_SIGNATURE, typeElement);
 227         //Let's not link to ourselves in the signature.
 228         linkInfo.linkToSelf = false;
 229         Content className = new StringContent(utils.getSimpleName(typeElement));
 230         Content parameterLinks = getTypeParameterLinks(linkInfo);
 231         if (configuration.linksource) {
 232             addSrcLink(typeElement, className, pre);
 233             pre.add(parameterLinks);
 234         } else {
 235             Content span = HtmlTree.SPAN(HtmlStyle.typeNameLabel, className);
 236             span.add(parameterLinks);
 237             pre.add(span);
 238         }
 239         if (utils.isRecord(typeElement)) {
 240             pre.add(getRecordComponents(typeElement));
 241         }
 242         if (!utils.isInterface(typeElement)) {
 243             TypeMirror superclass = utils.getFirstVisibleSuperClass(typeElement);
 244             if (superclass != null) {
 245                 pre.add(DocletConstants.NL);
 246                 pre.add("extends ");
 247                 Content link = getLink(new LinkInfoImpl(configuration,
 248                         LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
 249                         superclass));
 250                 pre.add(link);
 251             }


 282         for (RecordComponentElement e : typeElement.getRecordComponents()) {
 283             content.add(sep);
 284             getAnnotations(e.getAnnotationMirrors(), false).stream()
 285                     .forEach(a -> { content.add(a); content.add(" "); });
 286             Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RECORD_COMPONENT,
 287                     e.asType()));
 288             content.add(link);
 289             content.add(Entity.NO_BREAK_SPACE);
 290             content.add(e.getSimpleName());
 291             sep = ", ";
 292         }
 293         content.add(")");
 294         return content;
 295     }
 296 
 297     /**
 298      * {@inheritDoc}
 299      */
 300     @Override
 301     public void addClassDescription(Content classInfoTree) {
 302         if(!configuration.nocomment) {
 303             // generate documentation for the class.
 304             if (!utils.getFullBody(typeElement).isEmpty()) {
 305                 addInlineComment(typeElement, classInfoTree);
 306             }
 307         }
 308     }
 309 
 310     /**
 311      * {@inheritDoc}
 312      */
 313     @Override
 314     public void addClassTagInfo(Content classInfoTree) {
 315         if(!configuration.nocomment) {
 316             // Print Information about all the tags here
 317             addTagsInfo(typeElement, classInfoTree);
 318         }
 319     }
 320 
 321     /**
 322      * Get the class hierarchy tree for the given class.
 323      *
 324      * @param type the class to print the hierarchy for
 325      * @return a content tree for class inheritance
 326      */
 327     private Content getClassInheritanceTree(TypeMirror type) {
 328         TypeMirror sup;
 329         HtmlTree classTree = null;
 330         do {
 331             sup = utils.getFirstVisibleSuperClass(type);
 332             HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
 333             if (classTree != null)
 334                 htmlElement.add(classTree);
 335             classTree = htmlElement;




 211     protected TypeElement getCurrentPageElement() {
 212         return typeElement;
 213     }
 214 
 215     /**
 216      * {@inheritDoc}
 217      */
 218     @Override @SuppressWarnings("preview")
 219     public void addClassSignature(String modifiers, Content classInfoTree) {
 220         Content hr = new HtmlTree(HtmlTag.HR);
 221         classInfoTree.add(hr);
 222         Content pre = new HtmlTree(HtmlTag.PRE);
 223         addAnnotationInfo(typeElement, pre);
 224         pre.add(modifiers);
 225         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
 226                 LinkInfoImpl.Kind.CLASS_SIGNATURE, typeElement);
 227         //Let's not link to ourselves in the signature.
 228         linkInfo.linkToSelf = false;
 229         Content className = new StringContent(utils.getSimpleName(typeElement));
 230         Content parameterLinks = getTypeParameterLinks(linkInfo);
 231         if (configuration.getOptions().linkSource) {
 232             addSrcLink(typeElement, className, pre);
 233             pre.add(parameterLinks);
 234         } else {
 235             Content span = HtmlTree.SPAN(HtmlStyle.typeNameLabel, className);
 236             span.add(parameterLinks);
 237             pre.add(span);
 238         }
 239         if (utils.isRecord(typeElement)) {
 240             pre.add(getRecordComponents(typeElement));
 241         }
 242         if (!utils.isInterface(typeElement)) {
 243             TypeMirror superclass = utils.getFirstVisibleSuperClass(typeElement);
 244             if (superclass != null) {
 245                 pre.add(DocletConstants.NL);
 246                 pre.add("extends ");
 247                 Content link = getLink(new LinkInfoImpl(configuration,
 248                         LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
 249                         superclass));
 250                 pre.add(link);
 251             }


 282         for (RecordComponentElement e : typeElement.getRecordComponents()) {
 283             content.add(sep);
 284             getAnnotations(e.getAnnotationMirrors(), false).stream()
 285                     .forEach(a -> { content.add(a); content.add(" "); });
 286             Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RECORD_COMPONENT,
 287                     e.asType()));
 288             content.add(link);
 289             content.add(Entity.NO_BREAK_SPACE);
 290             content.add(e.getSimpleName());
 291             sep = ", ";
 292         }
 293         content.add(")");
 294         return content;
 295     }
 296 
 297     /**
 298      * {@inheritDoc}
 299      */
 300     @Override
 301     public void addClassDescription(Content classInfoTree) {
 302         if(!configuration.getOptions().noComment) {
 303             // generate documentation for the class.
 304             if (!utils.getFullBody(typeElement).isEmpty()) {
 305                 addInlineComment(typeElement, classInfoTree);
 306             }
 307         }
 308     }
 309 
 310     /**
 311      * {@inheritDoc}
 312      */
 313     @Override
 314     public void addClassTagInfo(Content classInfoTree) {
 315         if(!configuration.getOptions().noComment) {
 316             // Print Information about all the tags here
 317             addTagsInfo(typeElement, classInfoTree);
 318         }
 319     }
 320 
 321     /**
 322      * Get the class hierarchy tree for the given class.
 323      *
 324      * @param type the class to print the hierarchy for
 325      * @return a content tree for class inheritance
 326      */
 327     private Content getClassInheritanceTree(TypeMirror type) {
 328         TypeMirror sup;
 329         HtmlTree classTree = null;
 330         do {
 331             sup = utils.getFirstVisibleSuperClass(type);
 332             HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
 333             if (classTree != null)
 334                 htmlElement.add(classTree);
 335             classTree = htmlElement;


< prev index next >