當前位置: 首頁>>代碼示例>>Java>>正文


Java Name.equals方法代碼示例

本文整理匯總了Java中javax.lang.model.element.Name.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Name.equals方法的具體用法?Java Name.equals怎麽用?Java Name.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.lang.model.element.Name的用法示例。


在下文中一共展示了Name.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkParamDeclared

import javax.lang.model.element.Name; //導入方法依賴的package包/類
@NbBundle.Messages({"# {0} - @param name", "UNKNOWN_TYPEPARAM_DESC=Unknown @param: {0}",
                    "# {0} - @param name", "DUPLICATE_PARAM_DESC=Duplicate @param name: {0}"})
private void checkParamDeclared(ParamTree tree, List<? extends Element> list,
        DocTreePathHandle dtph, int start, int end, List<ErrorDescription> errors) {
    Name name = tree.getName().getName();
    boolean found = false;
    for (Element e: list) {
        if(ctx.isCanceled()) { return; }
        if (name.equals(e.getSimpleName())) {
            if(!foundParams.add(e)) {
                errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, DUPLICATE_PARAM_DESC(name), new RemoveTagFix(dtph, "@param").toEditorFix())); // NOI18N
            }
            found = true;
        }
    }
    if (!found) {
        errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, UNKNOWN_TYPEPARAM_DESC(name), new RemoveTagFix(dtph, "@param").toEditorFix())); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:Analyzer.java

示例2: ambiguousNames

import javax.lang.model.element.Name; //導入方法依賴的package包/類
private static Set<String> ambiguousNames(Types typeUtils, Set<TypeMirror> types) {
    Set<String> ambiguous = new HashSet<String>();
    Map<String, Name> simpleNamesToQualifiedNames = new HashMap<String, Name>();
    for (TypeMirror type : types) {
        if (type.getKind() == TypeKind.ERROR) {
            throw new MissingTypeException();
        }
        String simpleName = typeUtils.asElement(type).getSimpleName().toString();
  /*
   * Compare by qualified names, because in Eclipse JDT, if Java 8 type annotations are used,
   * the same (unannotated) type may appear multiple times in the Set<TypeMirror>.
   * TODO(emcmanus): investigate further, because this might cause problems elsewhere.
   */
        Name qualifiedName = ((TypeElement)typeUtils.asElement(type)).getQualifiedName();
        Name previous = simpleNamesToQualifiedNames.put(simpleName, qualifiedName);
        if (previous != null && !previous.equals(qualifiedName)) {
            ambiguous.add(simpleName);
        }
    }
    return ambiguous;
}
 
開發者ID:ccheptea,項目名稱:auto-value-node,代碼行數:22,代碼來源:TypeSimplifier.java

示例3: ambiguousNames

import javax.lang.model.element.Name; //導入方法依賴的package包/類
private static Set<String> ambiguousNames(Types typeUtils, Set<TypeMirror> types) {
  Set<String> ambiguous = new HashSet<String>();
  Map<String, Name> simpleNamesToQualifiedNames = new HashMap<String, Name>();
  for (TypeMirror type : types) {
    if (type.getKind() == TypeKind.ERROR) {
      throw new MissingTypeException();
    }
    String simpleName = typeUtils.asElement(type).getSimpleName().toString();
    /*
     * Compare by qualified names, because in Eclipse JDT, if Java 8 type annotations are used,
     * the same (unannotated) type may appear multiple times in the Set<TypeMirror>.
     * TODO(emcmanus): investigate further, because this might cause problems elsewhere.
     */
    Name qualifiedName = ((TypeElement)typeUtils.asElement(type)).getQualifiedName();
    Name previous = simpleNamesToQualifiedNames.put(simpleName, qualifiedName);
    if (previous != null && !previous.equals(qualifiedName)) {
      ambiguous.add(simpleName);
    }
  }
  return ambiguous;
}
 
開發者ID:sopak,項目名稱:auto-value-step-builder,代碼行數:22,代碼來源:TypeSimplifier.java

示例4: needLongName

import javax.lang.model.element.Name; //導入方法依賴的package包/類
protected final boolean needLongName(ExecutableElement method,
                                     TypeElement clazz) {
    Name methodName = method.getSimpleName();
    for (ExecutableElement memberMethod: methods) {
        if ((memberMethod != method) &&
            memberMethod.getModifiers().contains(Modifier.NATIVE) &&
                (methodName.equals(memberMethod.getSimpleName())))
            return true;
    }
    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:LLNI.java

示例5: computeFixes

import javax.lang.model.element.Name; //導入方法依賴的package包/類
protected static Fix computeFixes(CompilationInfo info, TreePath treePath, int[] bounds, int[] kind, String[] simpleName) {
    if (treePath.getLeaf().getKind() != Kind.MEMBER_SELECT) {
        return null;
    }
    MemberSelectTree mst = (MemberSelectTree)treePath.getLeaf();
    Tree expression = mst.getExpression();
    TreePath expr = new TreePath(treePath, expression);
    
    TypeMirror tm = info.getTrees().getTypeMirror(expr);
    if (!Utilities.isValidType(tm)) {
        return null;
    }
    Element el = info.getTypes().asElement(tm);
    if (el == null || (!el.getKind().isClass() && !el.getKind().isInterface())) {
        return null;
    }
    
    TypeElement type = (TypeElement)el;
    
    if (isError(type)) {
        return null;
    }
    
    Name idName = null;
    
    if (expression.getKind() == Kind.MEMBER_SELECT) {
        MemberSelectTree exprSelect = (MemberSelectTree)expression;
        idName = exprSelect.getIdentifier();
    }
    
    if (expression.getKind() == Kind.IDENTIFIER) {
        IdentifierTree idt = (IdentifierTree)expression;
        idName = idt.getName();
    }
    
    if (idName != null) {
        if (idName.equals(type.getSimpleName())) {
            return null;
        }
        if (idName.equals(type.getQualifiedName())) {
            return null;
        }
    }
    
    Element used = info.getTrees().getElement(treePath);
    
    if (used == null || !used.getModifiers().contains(Modifier.STATIC)) {
        return null;
    }
    
    if (isError(used)) {
        return null;
    }
    
    if (used.getKind().isField()) {
        kind[0] = 0;
    } else {
        if (used.getKind() == ElementKind.METHOD) {
            kind[0] = 1;
        } else {
            kind[0] = 2;
        }
    }
    
    simpleName[0] = used.getSimpleName().toString();
    
    return new FixImpl(info, expr, type).toEditorFix();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:69,代碼來源:StaticAccess.java


注:本文中的javax.lang.model.element.Name.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。