All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.groovy.tools.groovydoc.gstring-templates.class-level.classDocName.html Maven / Gradle / Ivy

There is a newer version: 3.0.22
Show newest version





<%
    def title = classDoc.name() + (props.docTitle ? " (${props.docTitle})" : "")
    def visibleFields = classDoc.fields().findAll{ !it.isPrivate() || props.privateScope }
    def visibleProperties = classDoc.properties().findAll{ !it.isPrivate() || props.privateScope }
    boolean hasFields = !classDoc.isAnnotationType() && visibleFields.size() > 0
    boolean hasProperties = !classDoc.isAnnotationType() && visibleProperties.size() > 0
    boolean hasElements = classDoc.isAnnotationType() && visibleFields.size() > 0
    boolean hasConstructors = classDoc.constructors().size() > 0
    boolean hasNested = classDoc.innerClasses().size() > 0
    def visibleMethods = classDoc.methods().findAll{ !it.isPrivate() || props.privateScope }
    boolean hasMethods = visibleMethods.size() > 0
    boolean methodSummaryShown = hasMethods
    boolean fieldSummaryShown = hasFields
    boolean hasEnumConstants = classDoc.enumConstants().size() > 0
    def dolink = { t, boolean b ->
        if (!t || t instanceof String) {
            return classDoc.getDocUrl(t, b)
        }
        if (t instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
            return "" + (b ? t.qualifiedTypeName() : t.name()) + ""
        }
        return classDoc.getDocUrl(t.qualifiedTypeName(), b)
    }
    def linkfull = { t -> dolink(t, true) }
    def linkable = { t -> dolink(t, false) }
    def modifiers = { t ->
        (t.isPrivate()?"private ":"") +
        (t.isPublic()?"public ":"") +
        (t.isProtected()?"protected ":"") +
        (t.isStatic()?"static ":"") +
        (t.isFinal()?"final ":"") +
        (t.respondsTo('isAbstract') && t.isAbstract()?"abstract ":"")
    }
    def modifiersBrief = { t ->
        (t.isPrivate()?"private ":"") +
        (t.isProtected()?"protected ":"") +
        (t.isStatic()?"static ":"")
    }
    def annotations = { t, sepChar -> t.annotations() ? t.annotations()*.description().join(sepChar) + sepChar : '' }
    def isVisible = { t -> java.lang.reflect.Modifier.isPublic(t.modifiers) || java.lang.reflect.Modifier.isProtected(t.modifiers) }
    def elementTypes = [
        "required":"true",
        "optional":"false"
    ]
    def isRequired = { f, v -> def req = f.constantValueExpression() == null; req.toString() == v }
    def upcase = { n -> n[0].toUpperCase() + n[1..-1] }
    def paramsOf = { n, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, ' ')) + linkable(param.isTypeAvailable()?param.type():param.typeName()) + ' ' + param.name() + (param.defaultValue() ? " = " + param.defaultValue():"") }.join(", ") }
    def nameFromParams = { n -> n.name() + '(' + n.parameters().collect{ param -> param.isTypeAvailable()?param.type().qualifiedTypeName():param.typeName() }.join(', ') + ')' }
%>



${title}









<% if (props.header) { %>${props.header}<% } %>

${classDoc.containingPackage().nameWithDots()}
${classDoc.typeDescription} ${classDoc.name()}

<% def parents = classDoc.isInterface() ? classDoc.parentInterfaces : classDoc.parentClasses if (parents.size() >= 2) { %>
<%
    parents.eachWithIndex { p, i ->
        %>${(i > 0 ? "  " * i + "  " * (i - 1) + "" : "") + ( i == parents.size() - 1 ? p.qualifiedTypeName() : linkfull(p))}\n<%
    }
    %>
<% } if (classDoc.isInterface()) { Set interfaces = classDoc.parentInterfaces interfaces -= classDoc if (interfaces) { %>
All Superinterfaces:
${interfaces.collect{ linkable(it) }.join(', ')}
<% } } else { // TODO follow up the tree collecting interfaces seen? def interfaces = classDoc.interfaces() if (interfaces) { %>
All Implemented Interfaces:
${interfaces.collect{ linkable(it) }.join(', ')}
<% } } %>
${annotations(classDoc, '\n') + modifiers(classDoc) + classDoc.typeSourceDescription + ' ' + classDoc.name()}
<% if (classDoc.isInterface() && classDoc.interfaces()) {
%>extends ${classDoc.interfaces().collect{ linkable(it) }.join(', ')}
<% } else if (classDoc.superclass()) {
%>extends ${linkable(classDoc.superclass())}
<% } %>
<% if (classDoc.commentText()) { %>

${classDoc.commentText()}


<% } %> <% if (hasNested) { %> <% for (c in classDoc.innerClasses()) { %> <% } %>
Nested Class Summary
${modifiersBrief(c) + c.typeSourceDescription} ${linkable(c)}

${c.firstSentenceCommentText()}

  <% } %> <% if (hasEnumConstants) { %> <% for (ec in classDoc.enumConstants()) { %> <% } %>
Enum Constant Summary
${ec.name()}

${ec.firstSentenceCommentText()}

  <% } %> <% if (hasFields) { %> <% for (field in visibleFields) { %> <% } %>
Field Summary
${modifiersBrief(field) + linkable(field.type())} ${field.name()}

${field.firstSentenceCommentText()}

  <% } classes = [] if (classDoc.isInterface()) { classes.addAll(classDoc.interfaces().toList()) } else { if (classDoc.superclass()) classes += classDoc.superclass() else classes += new org.codehaus.groovy.tools.groovydoc.ExternalGroovyClassDoc(Object.class) } visited = [classDoc] as Set while (classes) { Set nextLevel = [] classes.each { c -> if (c.isInterface()) nextLevel.addAll(c.interfaces().toList()) else if (c.superclass() && c.qualifiedTypeName() != 'java.lang.Object') nextLevel += c.superclass() nextLevel -= visited visited += nextLevel def list = [] if (c instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) { list = c.fields().findAll{ it.isPublic() || it.isProtected() }.collect { field -> "${field.name()}" } } else { list = c.externalClass().fields.findAll{ isVisible(it) }.collect { field -> // "${field.name()}" field.name } } if (list) { if (!fieldSummaryShown) { fieldSummaryShown = true %>
Field Summary
 <% } %>
Fields inherited from ${c.typeSourceDescription} ${linkable(c)}
${list.join(', ')}
 <% } } classes = nextLevel } %> <% if (hasProperties) { %> <% for (prop in visibleProperties) { %> <% } %>
Property Summary
${modifiersBrief(prop) + linkable(prop.type())} ${prop.name()}

${prop.firstSentenceCommentText()}

  <% } %> <% if (hasElements) { %> <% elementTypes.each { k, v -> %> <% if (visibleFields.any{ isRequired(it, v) }) { %> <% for (element in visibleFields) { %> <% if (isRequired(element, v)) { %> <% } %> <% } %>
${upcase(k)} Element Summary
${modifiersBrief(element) + element.type().typeName()} ${element.name()}

${element.firstSentenceCommentText()}

<% } %>   <% } %> <% } %> <% if (hasConstructors) { %> <% for (constructor in classDoc.constructors()) { %> <% } %>
Constructor Summary
${modifiersBrief(constructor)}${constructor.name()}(${paramsOf(constructor, true)})

${constructor.firstSentenceCommentText()}

  <% } %> <% if (hasMethods) { %> <% for (method in visibleMethods) { %> <% } %>
Method Summary
${modifiersBrief(method)}${linkable(method.returnType())} ${method.name()}(${paramsOf(method, true)})

${method.firstSentenceCommentText()}

  <% } Set classes = [] if (classDoc.isInterface()) { classes.addAll(classDoc.interfaces().toList()) } else { if (classDoc.superclass()) classes += classDoc.superclass() else classes += new org.codehaus.groovy.tools.groovydoc.ExternalGroovyClassDoc(Object.class) } Set visited = [classDoc] as Set while (classes) { Set nextLevel = [] classes.each { c -> if (c.isInterface()) nextLevel.addAll(c.interfaces().toList()) else if (c.superclass() && c.qualifiedTypeName() != 'java.lang.Object') nextLevel += c.superclass() nextLevel -= visited visited += nextLevel def list = [] if (c instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) { list = c.methods().findAll{ it.isPublic() || it.isProtected() }.collect { method -> "${method.name()}" } } else { list = c.externalClass().methods.findAll{ isVisible(it) }.collect { method -> // "${method.name()}" method.name } } if (list) { if (!methodSummaryShown) { methodSummaryShown = true %>
Method Summary
 <% } %>
Methods inherited from ${c.typeSourceDescription} ${linkable(c)}
${list.join(', ')}
 <% } } classes = nextLevel } %>

<% if (hasEnumConstants) { %>

Enum Constant Detail
<% for (ec in classDoc.enumConstants()) { %>

${ec.name()}

${modifiers(ec) + '' + classDoc.name() + ''} ${ec.name()}
${ec.commentText()}


<% } %>   <% } %> <% if (hasFields) { %>
Field Detail
<% for (field in visibleFields) { %>

${field.name()}

${annotations(field, '\n') + modifiers(field) + linkable(field.type())} ${field.name()}
${field.commentText()}


<% } %>   <% } %> <% if (hasProperties) { %>
Property Detail
<% for (prop in visibleProperties) { %>

${prop.name()}

${annotations(prop, '\n') + modifiers(prop) + linkable(prop.type())} ${prop.name()}
${prop.commentText()}


<% } %>   <% } %> <% if (hasElements) { %>
Element Detail
<% for (element in visibleFields) { %>

${element.name()}

${modifiers(element) + linkable(element.type())} ${element.name()}
${element.commentText()}


<% } %>   <% } %> <% if (hasConstructors) { %>
Constructor Detail
<% for (constructor in classDoc.constructors()) { %>

${constructor.name()}

${annotations(constructor, '\n') + modifiers(constructor)}${constructor.name()}(${paramsOf(constructor, false)})
${constructor.commentText()}


<% } %>   <% } %> <% if (hasMethods) { %>
Method Detail
<% for (method in visibleMethods) { %>

${method.name()}

${annotations(method, '\n') + modifiers(method)}${linkable(method.returnType())} ${method.name()}(${paramsOf(method, false)})
${method.commentText()}


<% } %>   <% } %>

${props['footer']?:""}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy