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


Java ClassOrInterfaceDeclaration.getName方法代碼示例

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


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

示例1: visit

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
	List<ClassOrInterfaceType> extendsList = visit(_n.getExtends(), _arg);
	List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
       List<BodyDeclaration<?>> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
			_n.getRange(),
			_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
	);
	r.setComment(comment);
	return r;
}
 
開發者ID:javaparser,項目名稱:javasymbolsolver,代碼行數:17,代碼來源:CloneVisitor.java

示例2: visit

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
	JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
	List<ClassOrInterfaceType> extendsList = visit(_n.getExtends(), _arg);
	List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
	List<BodyDeclaration> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
			_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
			_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
	);
	r.setComment(comment);
	return r;
}
 
開發者ID:plum-umd,項目名稱:java-sketch,代碼行數:18,代碼來源:CloneVisitor.java

示例3: InnerNode

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
public InnerNode( ClassOrInterfaceDeclaration dec) 
{
    super(dec.getName());
    compUnit = dec;
    innerClassMethods = new ArrayList<MethodDeclaration>();
    innerMethodIndex = 0;
    nodeName = dec.getNameAsString();
    new FindInnerMethods().visit(compUnit, null);
    new ConsturctorVisitor().visit(compUnit, null);
    new MethodVisitor().visit( compUnit, null);        
    new InnerClassVisitor().visit(compUnit, null);
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:13,代碼來源:InnerNode.java

示例4: visit

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
@Override
public void visit(ClassOrInterfaceDeclaration n, Object arg) {
  super.visit(n, arg);
  final EnumSet<Modifier> modifiers = n.getModifiers();
  if (!modifiers.contains(Modifier.PRIVATE)) {
    final List<BodyDeclaration<?>> members = n.getMembers();
    final SimpleName simpleName = n.getName();
    final String clazz = simpleName.getId();
    // String clazz = n.getName();
    this.className = this.pkg + '.' + clazz;
    log.debug("class {}", this.className);
    int i = 0;
    for (final BodyDeclaration<?> body : members) {
      if (body instanceof MethodDeclaration) {
        MethodDeclaration methodDeclaration = (MethodDeclaration) body;
        this.getParameterNames(methodDeclaration, n.isInterface());
        i++;
      } else if (body instanceof ConstructorDeclaration) {
        // Constructor
      } else if (body instanceof ClassOrInterfaceDeclaration) {
        final ClassOrInterfaceDeclaration classOrInterfaceDeclaration =
            (ClassOrInterfaceDeclaration) body;
        String name = classOrInterfaceDeclaration.getName().getIdentifier();
        String key = this.pkg + '.' + name;
        name = this.originClassName + '.' + name;
        for (MethodParameterNames mpn : this.parameterNamesList) {
          if (mpn != null && mpn.className != null && mpn.className.equals(key)) {
            mpn.className = name;
          }
        }
      }
    }

    if (i > 0 && this.names.className != null) {
      this.parameterNamesList.add(this.names);
      this.names = new MethodParameterNames();
    }
  }
}
 
開發者ID:mopemope,項目名稱:meghanada-server,代碼行數:40,代碼來源:ParameterNameVisitor.java

示例5: isInTheCorrectClass

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
private boolean isInTheCorrectClass(MethodDeclaration methodDeclaration) {
	Node n = methodDeclaration;
	
	String containingClassName = "";
	while (n != null) {
		if (n instanceof ClassOrInterfaceDeclaration) {
			ClassOrInterfaceDeclaration c = (ClassOrInterfaceDeclaration) n;
			containingClassName = c.getName() + "$" + containingClassName;
		}
		n = n.getParentNode();
	}
	
	containingClassName = containingClassName.substring(0, containingClassName.length() - 1);
	return containingClassName.equals(className);
}
 
開發者ID:dodie,項目名稱:scott,代碼行數:16,代碼來源:MethodBoundaryExtractor.java

示例6: visit

import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; //導入方法依賴的package包/類
@Override
public void visit(final ClassOrInterfaceDeclaration n, final Void arg) {
    type = n.getName();
    super.visit(n, arg);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:6,代碼來源:AbstractVerifier.java


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