本文整理汇总了Java中com.sun.mirror.declaration.Declaration.getDocComment方法的典型用法代码示例。如果您正苦于以下问题:Java Declaration.getDocComment方法的具体用法?Java Declaration.getDocComment怎么用?Java Declaration.getDocComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.mirror.declaration.Declaration
的用法示例。
在下文中一共展示了Declaration.getDocComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ProcessedHttpUrlAnnotation
import com.sun.mirror.declaration.Declaration; //导入方法依赖的package包/类
public ProcessedHttpUrlAnnotation(String typeName, Declaration declaration, String value, int weight) {
MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
String className = methodDeclaration.getDeclaringType().getQualifiedName();
this.methodName = declaration.getSimpleName();
this.docComment = declaration.getDocComment();
this.className = className;
this.value = value;
this.weight = weight;
this.setParams(methodDeclaration.getParameters());
String typeNameShort = typeName.substring(typeName.lastIndexOf("."));
SourcePosition positionInCode = declaration.getPosition();
sourceRef = positionInCode.file().getName() + ":" + positionInCode.line();
if (!(declaration instanceof MethodDeclaration)) {
messager.printWarning(positionInCode, "@" + typeNameShort + " declared on a non-method " + positionInCode);
}
if (showPositionsOfAnnotations) {
messager.printNotice(positionInCode, "@" + typeNameShort + " value " + value + " weight " + weight);
}
}
示例2: processHttpExceptionHandlerAnnotation
import com.sun.mirror.declaration.Declaration; //导入方法依赖的package包/类
private ProcessedHttpExceptionAnnotation processHttpExceptionHandlerAnnotation(Declaration declaration) {
SourcePosition position = declaration.getPosition();
if (!(declaration instanceof MethodDeclaration)) {
messager.printWarning(declaration.getPosition(), "@HttpExceptionHandler declared on a non-method " + position);
return null;
}
MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
HttpExceptionHandler httpExceptionHandler = declaration.getAnnotation(HttpExceptionHandler.class);
String className = methodDeclaration.getDeclaringType().getQualifiedName();
ProcessedHttpExceptionAnnotation ea = new ProcessedHttpExceptionAnnotation();
ea.exceptionName = httpExceptionHandler.value(); //.getName();
ea.methodName = declaration.getSimpleName();
ea.docComment = declaration.getDocComment();
ea.className = className;
ea.setParams(methodDeclaration.getParameters());
// out exceptionName might not be set
if ("[ unassigned ]".equals(ea.exceptionName) && methodDeclaration.getParameters().size() > 0) {
// use first param
ea.exceptionName = methodDeclaration.getParameters().iterator().next().getType().toString();
}
if (showPositionsOfAnnotations) {
messager.printNotice(position, "@HttpExceptionHandlerUrl value " + ea.value + " weight " + ea.weight);
}
return ea;
}
示例3: printDocComment
import com.sun.mirror.declaration.Declaration; //导入方法依赖的package包/类
private void printDocComment(Declaration d) {
if (d.getDocComment() != null)
out.println(asJavadoc(d.getDocComment()));
}