< prev index next >

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

Print this page




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


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




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


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


< prev index next >