本文整理汇总了Java中org.walkmod.javalang.ast.body.JavadocTag类的典型用法代码示例。如果您正苦于以下问题:Java JavadocTag类的具体用法?Java JavadocTag怎么用?Java JavadocTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavadocTag类属于org.walkmod.javalang.ast.body包,在下文中一共展示了JavadocTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMultipleTag
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testMultipleTag() throws Exception {
String javadoc = "@author <a href=\"mailto:[email protected]\">walkmod</a> \n @version 1.5 ";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 2);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@author", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
Assert.assertEquals("<a href=\"mailto:[email protected]\">walkmod</a>", jt.getValues().get(0));
jt = tags.get(1);
Assert.assertEquals("@version", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
Assert.assertEquals("1.5", jt.getValues().get(0));
}
示例2: testSpecificBlockTags
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testSpecificBlockTags() throws Exception {
String javadoc = "@param fooParam my param description";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@param", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(2, jt.getValues().size());
Assert.assertEquals("fooParam", jt.getValues().get(0));
Assert.assertEquals("my param description", jt.getValues().get(1));
javadoc = "@param fooParam";
tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
jt = tags.get(0);
Assert.assertEquals("@param", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
Assert.assertEquals("fooParam", jt.getValues().get(0));
}
示例3: processJavadocTypeReference
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
private void processJavadocTypeReference(String type, JavadocTag n) {
if (type != null) {
String[] split = type.split("#");
String typeName = split[0];
if (!"".equals(typeName)) {
symbolTable.lookUpSymbolForRead(typeName, n, ReferenceType.TYPE);
}
if (split.length == 2) {
String signature = split[1];
int start = signature.indexOf("(");
if (start > 0 && signature.endsWith(")")) {
signature = signature.substring(start + 1, signature.length() - 1);
String[] params = signature.split(",");
if (params != null) {
for (String param : params) {
if (!"".equals(param)) {
if (param.endsWith("[]")) {
param = param.substring(0, param.length() - 2);
}
symbolTable.lookUpSymbolForRead(param.trim(), n, ReferenceType.TYPE);
}
}
}
}
}
}
}
示例4: javadoc
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
final public List<JavadocTag> javadoc() throws ParseException {
List<JavadocTag> result = new LinkedList();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case PARAM:
case RETURN:
case THROWS:
case EXCEPTION:
case SEE:
case SERIALFIELD:
case SERIALDATA:
case SERIAL:
case DEPRECATED:
case AUTHOR:
case SINCE:
case VERSION:
case OPENBRACE:
case CLOSEBRACE:
case ASTERISK:
case IDENTIFIER:
case NAMECHAR:
case OPERATION:
case WORD:
description(result);
break;
default:
jj_la1[0] = jj_gen;;
}
jj_consume_token(0);
{
if (true)
return result;
}
throw new Error("Missing return statement in function");
}
示例5: parse
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
public static List<JavadocTag> parse(String content) throws Exception {
List<JavadocTag> javadocTags = null;
if (content != null) {
InputStream is = new ByteArrayInputStream(content.getBytes());
try {
javadocTags = TagsParser.parse(is);
} finally {
is.close();
}
}
return javadocTags;
}
示例6: testInlineTags
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testInlineTags() throws Exception {
String javadoc = "Use the {@link #getComponentAt(int, int) getComponentAt} method.";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@link", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(2, jt.getValues().size());
Assert.assertEquals("#getComponentAt(int, int)", jt.getValues().get(0));
Assert.assertEquals("getComponentAt", jt.getValues().get(1));
}
示例7: testInlineTagsWithArray
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testInlineTagsWithArray() throws Exception {
String javadoc = "Use the {@link #getComponentAt(int[], int[]) getComponentAt} method.";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@link", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(2, jt.getValues().size());
Assert.assertEquals("#getComponentAt(int[], int[])", jt.getValues().get(0));
Assert.assertEquals("getComponentAt", jt.getValues().get(1));
}
示例8: testInnnerCode
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testInnnerCode() throws Exception {
String javadoc = "{@code \n" + "public static double sqrt(double value) {\n"
+ " Preconditions.checkArgument(value >= 0.0, \"negative value: %s\", value);\n"
+ " // calculate the square root\n" + "}\n" + "void exampleBadCaller() {\n"
+ " double d = sqrt(-1.0);\n" + "}};";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@code", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
String code = jt.getValues().get(0);
Assert.assertTrue(code.contains("double d = sqrt(-1.0);"));
}
示例9: testInnnerEmptyBraces
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testInnnerEmptyBraces() throws Exception {
String javadoc = "{@code \n" + " static <T> TypeToken<List<T>> listOf(Class<T> elementType) {\n"
+ " return new TypeToken<List<T>>() {}\n"
+ " .where(new TypeParameter<T>() {}, elementType);\n" + " }}";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@code", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
String code = jt.getValues().get(0);
Assert.assertTrue(code.contains("new TypeParameter<T>()"));
}
示例10: testInnnerJavadocTags
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testInnnerJavadocTags() throws Exception {
String javadoc = "{@code \n" + "/**\n" + "* Returns the positive square root of the given value.\n" + "*\n"
+ "* @throws IllegalArgumentException if the value is negative\n" + "*}";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@code", jt.getName());
Assert.assertNotNull(jt.getValues());
Assert.assertEquals(1, jt.getValues().size());
String code = jt.getValues().get(0);
Assert.assertTrue(code.contains("@throws IllegalArgumentException"));
}
示例11: testMultipleLineJavadocTags
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testMultipleLineJavadocTags() throws Exception {
String javadoc = "Weak reference with a method which a background thread invokes after\n";
javadoc += "* the garbage collector reclaims the referent. This is a simpler alternative to using a {@link\n";
javadoc += "* ReferenceQueue }.";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() == 1);
JavadocTag jt = tags.get(0);
Assert.assertEquals("@link", jt.getName());
Assert.assertEquals("ReferenceQueue", jt.getValues().get(0));
}
示例12: testJavadocFailure
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testJavadocFailure() throws Exception {
String javadoc = FileUtils.fileToString("src/test/resources/javadocFailure.txt");
javadoc = javadoc.replaceAll("\\*", "");
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(tags.size() > 1);
}
示例13: parse
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
public static List<JavadocTag> parse(InputStream aInSt) throws ParseException {
// create a parser (this object)
TagsParser parser = new TagsParser(aInSt);
// parse!
return parser.javadoc();
}
示例14: main
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
public List<JavadocTag> main(String[] args) throws ParseException, FileNotFoundException {
return parse(new FileInputStream(args[0]));
}
示例15: testSingleTag
import org.walkmod.javalang.ast.body.JavadocTag; //导入依赖的package包/类
@Test
public void testSingleTag() throws Exception {
String javadoc = "@author walkmod";
List<JavadocTag> tags = JavadocManager.parse(javadoc);
Assert.assertTrue(!tags.isEmpty());
}