本文整理匯總了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;
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例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);
}
示例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);
}