本文整理汇总了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;
}