本文整理匯總了Java中com.sun.source.tree.Tree.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Tree.toString方法的具體用法?Java Tree.toString怎麽用?Java Tree.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.source.tree.Tree
的用法示例。
在下文中一共展示了Tree.toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: composeArguments
import com.sun.source.tree.Tree; //導入方法依賴的package包/類
private final MethodArgument[] composeArguments(List<? extends Tree> args, List<? extends Tree> argTypes) {
int n = args.size();
MethodArgument[] arguments = new MethodArgument[n];
for (int i = 0; i < n; i++) {
Tree var = args.get(i);
long startOffset = positions.getStartPosition(tree, var);
long endOffset = positions.getEndPosition(tree, var);
if (startOffset == Diagnostic.NOPOS || endOffset == Diagnostic.NOPOS) {
return new MethodArgument[] {};
}
arguments[i] = new MethodArgument(var.toString(),
(argTypes.size() > i) ? argTypes.get(i).toString() : "",
positionDelegate.createPosition(
(int) startOffset,
(int) lineMap.getLineNumber(startOffset),
(int) lineMap.getColumnNumber(startOffset)),
positionDelegate.createPosition(
(int) endOffset,
(int) lineMap.getLineNumber(endOffset),
(int) lineMap.getColumnNumber(endOffset)));
}
return arguments;
}
示例2: qualifiedString
import com.sun.source.tree.Tree; //導入方法依賴的package包/類
private static String qualifiedString(Tree tree) {
switch (tree.getKind()) {
case IDENTIFIER:
return ((IdentifierTree) tree).getName().toString();
case MEMBER_SELECT:
MemberSelectTree select = (MemberSelectTree) tree;
return qualifiedString(select.getExpression()) + '.' + select.getIdentifier().toString();
default:
throw new AssertionError(tree.toString());
}
}
示例3: create
import com.sun.source.tree.Tree; //導入方法依賴的package包/類
public static <T extends TypeMirror> MemberInfo<TypeMirrorHandle<T>> create(T el, Tree t, CompilationInfo c) {
MemberInfo<TypeMirrorHandle<T>> mi = new MemberInfo<TypeMirrorHandle<T>>(TypeMirrorHandle.create(el), t.toString(), "implements " + t.toString(), ElementIcons.getElementIcon(ElementKind.INTERFACE, null)); // NOI18N
mi.group = Group.IMPLEMENTS;
return mi;
}