org.codehaus.groovy.tools.groovydoc.gstringTemplates.topLevel.deprecated-list.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groovy-all Show documentation
Show all versions of groovy-all Show documentation
Groovy: A powerful, dynamic language for the JVM
<%
def subtitle = 'Deprecated API'
def title = subtitle + (props.windowTitle ? " (${props.windowTitle})" : "")
// TODO enable errors(), enums() etc in SimpleGroovyPackageDoc then replace closures below
def isVisible = { it.isPublic() || (it.isProtected() && props.protectedScope == 'true') || (!it.isProtected() && !it.isPrivate() && props.packageScope == 'true') || props.privateScope == 'true' }
def classTypes = [
"Interface" : { it.isInterface() && it.isDeprecated() },
"Trait" : { it.isTrait() && it.isDeprecated() },
"Class" : { it.isClass() && !it.parentClasses*.qualifiedTypeName().contains('java.lang.Throwable') && it.isDeprecated() },
"Enum" : { it.isEnum() && it.isDeprecated() },
"Exception" : { it.isClass() && it.parentClasses*.qualifiedTypeName().contains('java.lang.Exception') && it.isDeprecated() },
"Error" : { it.isClass() && it.parentClasses*.qualifiedTypeName().contains('java.lang.Error') && it.isDeprecated() },
"Annotation Type" : { it.isAnnotationType() && it.isDeprecated() }
]
def deprecations = [:]
classTypes.each{ k, v ->
deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}
def methodTypes = [
"Method" : { it.methods().findAll{ it.isDeprecated() } },
"Constructor" : { it.constructors().findAll{ it.isDeprecated() } },
]
methodTypes.each{ k, v ->
deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}
def fieldTypes = [
"Field" : { it.fields().findAll{ it.isDeprecated() } },
"Property" : { it.properties().findAll{ it.isDeprecated() } },
"Enum Constant" : { it.enumConstants().findAll{ it.isDeprecated() } },
]
fieldTypes.each{ k, v ->
deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}
def pluralize = { name ->
name.endsWith('y')?name.substring(0, name.length()-1)+'ies':(name + (name.endsWith("s") ? "es" : "s"))
}
def dolink = { t, classDoc, 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 linkable = { t, classDoc -> dolink(t, classDoc, false) }
def modifiersBrief = { t ->
(t.isPrivate()?"private ":"") +
(t.isProtected()?"protected ":"") +
(t.isStatic()?"static ":"")
}
def paramsOf = { n, classDoc, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, ' ')) + linkable(param.isTypeAvailable()?param.type():param.typeName(), classDoc) + ' ' + 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}
<%
fieldTypes.each{ k, v ->
if (deprecations[k]) {
%>
-
Deprecated ${pluralize(k)}
${k} and Description
<%
rootDoc.classes().findAll{ isVisible(it) && v(it) }.each { classDoc ->
v(classDoc).eachWithIndex { field, i ->
%>
${classDoc.name()}#${field.name()}
${field.firstSentenceCommentText()}
<%
} // eachWithIndex { field, i ->
} // eachWithIndex.each { classDoc ->
%>
<% } // if rootDoc.classes()
} // fieldTypes.each
classTypes.each{ k, v ->
if (deprecations[k]) {
%>
-
Deprecated ${pluralize(k)}
${k} and Description
<%
rootDoc.classes().findAll{ isVisible(it) && v(it) }.eachWithIndex { classDoc, i ->
def packageOrInnerName = classDoc.qualifiedTypeName() - ('.' + classDoc.simpleTypeName())
%>
<%
if (classDoc.isInterface() || classDoc.isTrait()) { %><% }
%>${classDoc.name()}<%
if (classDoc.isInterface() || classDoc.isTrait()) { %><% }
%>
${classDoc.firstSentenceCommentText()}
<%
} // eachWithIndex
%>
<% } // if rootDoc.classes()
} // classTypes.each
methodTypes.each{ k, v ->
if (deprecations[k]) {
%>
-
Deprecated ${pluralize(k)}
${k} and Description
<%
rootDoc.classes().findAll{ isVisible(it) && v(it) }.each { classDoc ->
v(classDoc).eachWithIndex { methOrConstr, i ->
%>
${classDoc.name()}#${methOrConstr.name()}(${paramsOf(methOrConstr, classDoc, true)})
${methOrConstr.firstSentenceCommentText()}
<%
} // eachWithIndex { methOrConstr, i ->
} // eachWithIndex.each { classDoc ->
%>
<% } // if (rootDoc.classes()
} // methodTypes.each
%>