本文整理汇总了Java中org.eclipse.jdt.core.dom.Name.isSimpleName方法的典型用法代码示例。如果您正苦于以下问题:Java Name.isSimpleName方法的具体用法?Java Name.isSimpleName怎么用?Java Name.isSimpleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.Name
的用法示例。
在下文中一共展示了Name.isSimpleName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteReference
import org.eclipse.jdt.core.dom.Name; //导入方法依赖的package包/类
private RefactoringStatus rewriteReference(ASTRewrite astRewrite,
ImportRewrite importRewrite, SimpleName name,
String fullyQualifiedTypeName) {
final RefactoringStatus status = new RefactoringStatus();
// get the node to replace.
final Name nodeToReplace = Util.getTopmostName(name);
// If its in a case statement.
if (Util.isContainedInCaseLabel(name)) {
if (!nodeToReplace.isSimpleName()) // Need to remove prefix.
astRewrite.replace(nodeToReplace, name, null);
return status;
}
// Make a copy of the simple name.
final AST ast = name.getAST();
final SimpleName nameCopy = (SimpleName) ASTNode.copySubtree(ast, name);
final String typeName = importRewrite.addImport(fullyQualifiedTypeName);
final QualifiedName newNameNode = ast.newQualifiedName(
ast.newName(typeName), nameCopy);
astRewrite.replace(nodeToReplace, newNameNode, null);
return status;
}
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:27,代码来源:ConvertConstantsToEnumRefactoring.java
示例2: hasNullAnnotation
import org.eclipse.jdt.core.dom.Name; //导入方法依赖的package包/类
private static boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers = decl.modifiers();
String nonnull =
NullAnnotationsFix.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable =
NullAnnotationsFix.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName = ((Annotation) mod).getTypeName();
String fullyQualifiedName = annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName()
? nonnull.endsWith(fullyQualifiedName)
: fullyQualifiedName.equals(nonnull)) return true;
if (annotationName.isSimpleName()
? nullable.endsWith(fullyQualifiedName)
: fullyQualifiedName.equals(nullable)) return true;
}
}
return false;
}