本文整理汇总了Java中com.google.javascript.rhino.JSDocInfo.Marker方法的典型用法代码示例。如果您正苦于以下问题:Java JSDocInfo.Marker方法的具体用法?Java JSDocInfo.Marker怎么用?Java JSDocInfo.Marker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.JSDocInfo
的用法示例。
在下文中一共展示了JSDocInfo.Marker方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertDocumentationInMarker
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Asserts that a documentation field exists on the given marker.
*
* @param description The text of the documentation field expected.
* @param startCharno The starting character of the text.
* @param endLineno The ending line of the text.
* @param endCharno The ending character of the text.
* @return The marker, for chaining purposes.
*/
private JSDocInfo.Marker assertDocumentationInMarker(JSDocInfo.Marker marker,
String description,
int startCharno,
int endLineno,
int endCharno) {
assertTrue(marker.description != null);
assertEquals(description, marker.description.getItem());
// Match positional information.
assertEquals(marker.annotation.getStartLine(),
marker.description.getStartLine());
assertEquals(startCharno, marker.description.getPositionOnStartLine());
assertEquals(endLineno, marker.description.getEndLine());
assertEquals(endCharno, marker.description.getPositionOnEndLine());
return marker;
}
示例2: assertMarkerPosition
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
private void assertMarkerPosition(Node n, int lineno, int charno) {
int count = 0;
for (JSDocInfo.Marker marker : n.getJSDocInfo().getMarkers()) {
assertEquals(lineno, marker.annotation.getStartLine());
assertEquals(charno, marker.annotation.getPositionOnStartLine());
count++;
}
assertEquals(1, count);
}
示例3: assertTypeInMarker
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Asserts that a type field exists on the given marker.
*
* @param typeName The name of the type expected in the type field.
* @param startCharno The starting character of the type declaration.
* @param hasBrackets Whether the type in the type field is expected
* to have brackets.
* @return The marker, for chaining purposes.
*/
private JSDocInfo.Marker assertTypeInMarker(JSDocInfo.Marker marker,
String typeName, int startCharno,
boolean hasBrackets) {
assertTrue(marker.type != null);
assertTrue(marker.type.getItem().getType() == Token.STRING);
// Match the name and brackets information.
String foundName = marker.type.getItem().getString();
assertEquals(typeName, foundName);
assertEquals(hasBrackets, marker.type.hasBrackets);
// Match position information.
assertEquals(startCharno, marker.type.getPositionOnStartLine());
int endCharno = startCharno + foundName.length();
if (hasBrackets) {
endCharno += 1;
}
assertEquals(endCharno, marker.type.getPositionOnEndLine());
assertEquals(marker.annotation.getStartLine(), marker.type.getStartLine());
assertEquals(marker.annotation.getStartLine(), marker.type.getEndLine());
return marker;
}
示例4: assertNameInMarker
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Asserts that a name field exists on the given marker.
*
* @param name The name expected in the name field.
* @param startCharno The starting character of the text.
* @return The marker, for chaining purposes.
*/
private JSDocInfo.Marker assertNameInMarker(JSDocInfo.Marker marker,
String name, int startCharno) {
assertTrue(marker.name != null);
assertEquals(name, marker.name.getItem());
assertEquals(startCharno, marker.name.getPositionOnStartLine());
assertEquals(startCharno + name.length(),
marker.name.getPositionOnEndLine());
assertEquals(marker.annotation.getStartLine(), marker.name.getStartLine());
assertEquals(marker.annotation.getStartLine(), marker.name.getEndLine());
return marker;
}
示例5: assertAnnotationMarker
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Asserts that the index-th annotation marker of a given annotation name
* is found in the given JSDocInfo.
*
* @param jsdoc The JSDocInfo in which to search for the annotation marker.
* @param annotationName The name/type of the annotation for which to
* search. Example: "author" for an "@author" annotation.
* @param startLineno The expected starting line number of the marker.
* @param startCharno The expected character on the starting line.
* @param index The index of the marker.
* @return The marker found, for further testing.
*/
private JSDocInfo.Marker assertAnnotationMarker(JSDocInfo jsdoc,
String annotationName,
int startLineno,
int startCharno,
int index) {
Collection<JSDocInfo.Marker> markers = jsdoc.getMarkers();
assertTrue(markers.size() > 0);
int counter = 0;
for (JSDocInfo.Marker marker : markers) {
if (marker.annotation != null) {
if (annotationName.equals(marker.annotation.getItem())) {
if (counter == index) {
assertEquals(startLineno, marker.annotation.getStartLine());
assertEquals(startCharno,
marker.annotation.getPositionOnStartLine());
assertEquals(startLineno, marker.annotation.getEndLine());
assertEquals(startCharno + annotationName.length(),
marker.annotation.getPositionOnEndLine());
return marker;
}
counter++;
}
}
}
fail("No marker found");
return null;
}