use of com.sun.javadoc.ParamTag in project jersey by jersey.
the class ResourceDoclet method addParamDocs.
private static void addParamDocs(final MethodDoc methodDoc, final MethodDocType methodDocType, final DocProcessor docProcessor) {
final Parameter[] parameters = methodDoc.parameters();
final ParamTag[] paramTags = methodDoc.paramTags();
/* only use both javadoc and reflection information when the number
* of params are the same
*/
if (parameters != null && paramTags != null && parameters.length == paramTags.length) {
for (int i = 0; i < parameters.length; i++) {
final Parameter parameter = parameters[i];
/* TODO: this only works if the params and tags are in the same
* order. If the param tags are mixed up, the comments for parameters
* will be wrong.
*/
final ParamTag paramTag = paramTags[i];
final ParamDocType paramDocType = new ParamDocType();
paramDocType.setParamName(paramTag.parameterName());
paramDocType.setCommentText(paramTag.parameterComment());
docProcessor.processParamTag(paramTag, parameter, paramDocType);
final AnnotationDesc[] annotations = parameter.annotations();
if (annotations != null) {
for (final AnnotationDesc annotationDesc : annotations) {
final AnnotationDocType annotationDocType = new AnnotationDocType();
final String typeName = annotationDesc.annotationType().qualifiedName();
annotationDocType.setAnnotationTypeName(typeName);
for (final ElementValuePair elementValuePair : annotationDesc.elementValues()) {
final NamedValueType namedValueType = new NamedValueType();
namedValueType.setName(elementValuePair.element().name());
namedValueType.setValue(elementValuePair.value().value().toString());
annotationDocType.getAttributeDocs().add(namedValueType);
}
paramDocType.getAnnotationDocs().add(annotationDocType);
}
}
methodDocType.getParamDocs().add(paramDocType);
}
}
}
use of com.sun.javadoc.ParamTag in project RESTdoclet by IG-Group.
the class BaseType method initJavadoc.
/**
* Initialises the documentation of this parameter.
*
* @param param the parameter's Java documentation object.
* @param tags the Java documentation tags of the parameters of the method
* this parameter belongs to.
*/
protected void initJavadoc(final Parameter param, final ParamTag[] tags) {
for (ParamTag tag : tags) {
if (param.name().equals(tag.parameterName())) {
String comment = DocTypeUtils.getTypeDoc(param.type());
setJavadoc(DocletUtils.preserveJavadocFormatting(comment == null || comment.isEmpty() ? tag.parameterComment() : comment));
}
}
}
use of com.sun.javadoc.ParamTag in project RESTdoclet by IG-Group.
the class BaseTypeBuilder method initJavadoc.
/**
* Initialise type javadoc
*
* @param type type to initialise
* @param param parameter info
* @param tags tag info
*/
private void initJavadoc(BaseType type, final Parameter param, final ParamTag[] tags) {
LOG.debug(type.getType() + " - " + param.type() + " - " + param.name());
for (ParamTag tag : tags) {
if (param.name().equals(tag.parameterName())) {
String comment = DocTypeUtils.getTypeDoc(param.type());
LOG.debug(" - " + type.getType() + " : " + comment);
if (comment.isEmpty()) {
comment = tag.parameterComment();
} else {
comment = tag.parameterComment() + "<table><tr><td>" + comment + "</td></tr></table>";
}
type.setJavadoc(DocletUtils.preserveJavadocFormatting(comment));
}
}
}
use of com.sun.javadoc.ParamTag in project wso2-axis2-transports by wso2.
the class ResourceInfoDoclet method start.
public static boolean start(RootDoc root) throws IOException {
parseOptions(root.options());
ResourceInfo resourceInfo = new ResourceInfo();
for (ClassDoc clazz : root.classes()) {
Resource resource = null;
for (MethodDoc method : clazz.methods()) {
if (getAnnotation(method, "org.apache.axis2.transport.testkit.tests.Setup") != null) {
if (resource == null) {
resource = new Resource(clazz.qualifiedName());
}
ParamTag[] paramTags = method.paramTags();
for (Parameter parameter : method.parameters()) {
Type type = parameter.type();
String name = parameter.name();
String comment = null;
for (ParamTag paramTag : paramTags) {
if (paramTag.parameterName().equals(name)) {
comment = paramTag.parameterComment();
break;
}
}
if (comment == null) {
comment = getFirstSentence(root.classNamed(type.qualifiedTypeName()));
}
resource.addDependency(type.qualifiedTypeName(), type.dimension().equals("[]") ? "0..*" : "1", comment);
}
}
}
if (resource != null) {
resourceInfo.addResource(resource);
}
}
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(outFile));
out.writeObject(resourceInfo);
out.close();
return true;
}
use of com.sun.javadoc.ParamTag in project cxf by apache.
the class DumpJavaDoc method start.
public static boolean start(RootDoc root) throws IOException {
String dumpFileName = readOptions(root.options());
OutputStream os = Files.newOutputStream(Paths.get(dumpFileName));
Properties javaDocMap = new Properties();
for (ClassDoc classDoc : root.classes()) {
javaDocMap.put(classDoc.toString(), classDoc.commentText());
for (MethodDoc method : classDoc.methods()) {
javaDocMap.put(method.qualifiedName(), method.commentText());
for (ParamTag paramTag : method.paramTags()) {
Parameter[] parameters = method.parameters();
for (int i = 0; i < parameters.length; ++i) {
if (parameters[i].name().equals(paramTag.parameterName())) {
javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i, paramTag.parameterComment());
}
}
}
Tag[] retTags = method.tags("return");
if (retTags != null && retTags.length == 1) {
Tag retTag = method.tags("return")[0];
javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag", retTag.text());
}
}
}
javaDocMap.store(os, "");
os.flush();
os.close();
return true;
}
Aggregations