本文整理汇总了Java中com.github.javaparser.ast.body.EnumDeclaration.getImplements方法的典型用法代码示例。如果您正苦于以下问题:Java EnumDeclaration.getImplements方法的具体用法?Java EnumDeclaration.getImplements怎么用?Java EnumDeclaration.getImplements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.body.EnumDeclaration
的用法示例。
在下文中一共展示了EnumDeclaration.getImplements方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public void visit(final EnumDeclaration n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getJavaDoc() != null) {
n.getJavaDoc().accept(this, arg);
}
if (n.getAnnotations() != null) {
for (final AnnotationExpr a : n.getAnnotations()) {
a.accept(this, arg);
}
}
if (n.getImplements() != null) {
for (final ClassOrInterfaceType c : n.getImplements()) {
c.accept(this, arg);
}
}
if (n.getEntries() != null) {
for (final EnumConstantDeclaration e : n.getEntries()) {
e.accept(this, arg);
}
}
if (n.getMembers() != null) {
for (final BodyDeclaration member : n.getMembers()) {
member.accept(this, arg);
}
}
}
示例2: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public void visit(final EnumDeclaration n, final A arg) {
visitComment(n.getComment(), arg);
visitAnnotations(n, arg);
n.getNameExpr().accept(this, arg);
if (n.getImplements() != null) {
for (final ClassOrInterfaceType c : n.getImplements()) {
c.accept(this, arg);
}
}
if (n.getEntries() != null) {
for (final EnumConstantDeclaration e : n.getEntries()) {
e.accept(this, arg);
}
}
if (n.getMembers() != null) {
for (final BodyDeclaration<?> member : n.getMembers()) {
member.accept(this, arg);
}
}
}
示例3: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public void visit(final EnumDeclaration n, final A arg) {
jw.write(n);
visitComment(n.getComment(), arg);
if (n.getJavaDoc() != null) {
n.getJavaDoc().accept(this, arg);
}
if (n.getAnnotations() != null) {
for (final AnnotationExpr a : n.getAnnotations()) {
a.accept(this, arg);
}
}
if (n.getImplements() != null) {
for (final ClassOrInterfaceType c : n.getImplements()) {
c.accept(this, arg);
}
}
if (n.getEntries() != null) {
for (final EnumConstantDeclaration e : n.getEntries()) {
e.accept(this, arg);
}
}
if (n.getMembers() != null) {
for (final BodyDeclaration member : n.getMembers()) {
member.accept(this, arg);
}
}
}
示例4: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final EnumDeclaration n, final A arg) {
if (n.getJavaDoc() != null) {
n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg));
}
final List<AnnotationExpr> annotations = n.getAnnotations();
if (annotations != null) {
for (int i = 0; i < annotations.size(); i++) {
annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
}
removeNulls(annotations);
}
final List<ClassOrInterfaceType> implementz = n.getImplements();
if (implementz != null) {
for (int i = 0; i < implementz.size(); i++) {
implementz.set(i, (ClassOrInterfaceType) implementz.get(i).accept(this, arg));
}
removeNulls(implementz);
}
final List<EnumConstantDeclaration> entries = n.getEntries();
if (entries != null) {
for (int i = 0; i < entries.size(); i++) {
entries.set(i, (EnumConstantDeclaration) entries.get(i).accept(this, arg));
}
removeNulls(entries);
}
final List<BodyDeclaration> members = n.getMembers();
if (members != null) {
for (int i = 0; i < members.size(); i++) {
members.set(i, (BodyDeclaration) members.get(i).accept(this, arg));
}
removeNulls(members);
}
return n;
}
示例5: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final EnumDeclaration n, final A arg) {
visitComment(n, arg);
final List<AnnotationExpr> annotations = n.getAnnotations();
if (annotations != null) {
for (int i = 0; i < annotations.size(); i++) {
annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg));
}
removeNulls(annotations);
}
final List<ClassOrInterfaceType> implementz = n.getImplements();
if (implementz != null) {
for (int i = 0; i < implementz.size(); i++) {
implementz.set(i, (ClassOrInterfaceType) implementz.get(i).accept(this, arg));
}
removeNulls(implementz);
}
final List<EnumConstantDeclaration> entries = n.getEntries();
if (entries != null) {
for (int i = 0; i < entries.size(); i++) {
entries.set(i, (EnumConstantDeclaration) entries.get(i).accept(this, arg));
}
removeNulls(entries);
}
final List<BodyDeclaration<?>> members = n.getMembers();
if (members != null) {
for (int i = 0; i < members.size(); i++) {
members.set(i, (BodyDeclaration<?>) members.get(i).accept(this, arg));
}
removeNulls(members);
}
return n;
}
示例6: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override
public void visit(final EnumDeclaration n, final Object arg) {
printer.printLn("EnumDeclaration");
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
printer.print("enum ");
printer.print(n.getName());
if (n.getImplements() != null) {
printer.print(" implements ");
for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.printLn(" {");
printer.indent();
if (n.getEntries() != null) {
printer.printLn();
for (final Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext(); ) {
final EnumConstantDeclaration e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
if (n.getMembers() != null) {
printer.printLn(";");
printMembers(n.getMembers(), arg);
} else {
if (n.getEntries() != null) {
printer.printLn();
}
}
printer.unindent();
printer.print("}");
}
示例7: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override
public JCTree visit(final EnumDeclaration n, final Object arg) {
//ARG0: JCModifiers mods
JCModifiers arg0;
// Must convert internal modifiers
long jcmodifier = setJCTreeModifiers(n.getModifiers(), 0);
arg0 = new AJCModifiers(make.Modifiers(jcmodifier), null);
//ARG1: Name name
Name arg1 = names.fromString(n.getName());
//ARG2: List<JCTypeParameter> typarams,
List<JCTypeParameter> arg2 = List.<JCTypeParameter>nil();
//ARG3: JCExpression extending,
JCExpression arg3 = null;
/*
if (n.getJavaDoc() != null) {
JCTree result = n.getJavaDoc().accept(this, arg);
}
if (n.getAnnotations() != null) {
for (final AnnotationExpr a : n.getAnnotations()) {
JCTree result = a.accept(this, arg);
}
}
*/
//ARG4: List<JCExpression> implementing
List<JCExpression> arg4 = List.<JCExpression>nil();
if (n.getImplements() != null) {
for (final ClassOrInterfaceType c : n.getImplements()) {
arg4 = arg4.append((JCExpression) c.accept(this, arg));
}
}
//ARG5: List<JCTree> defs
// JCTree groups the const declaration and other declarations into the same list
List<JCTree> arg5 = List.<JCTree>nil();
if (n.getEntries() != null) {
for (final EnumConstantDeclaration e : n.getEntries()) {
arg5 = arg5.append(e.accept(this, arg));
}
}
if (n.getMembers() != null) {
for (final BodyDeclaration member : n.getMembers()) {
arg5 = arg5.append(member.accept(this, arg));
}
}
return new AJCClassDecl(make.ClassDef(arg0, arg1, arg2, arg3, arg4, arg5), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例8: parseEnum
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
/**
*
* @param td
* the parsed enum
* @return
* an enum structure
*/
private EnumDecl parseEnum(TypeDeclaration td) {
// enum
EnumDeclaration enumeration = (EnumDeclaration) td;
EnumDecl enumDecl = new EnumDecl();
ClassRef superClass = new ClassRef();
if (td.getComment()!= null) {
List<String> javadoc = ParserUtils.prepareComments(td.getComment().getContent());
enumDecl.setDoc(javadoc);
}
enumDecl.setName(td.getName());
enumDecl.setVisibility(visibility(td.getModifiers()));
if (enumeration.getEntries() != null) {
List<Ident> entries = new ArrayList<>();
for (Ident entry : entries) {
Ident ident = new Ident(entry.getName());
entries.add(ident);
this.loc++;
}
enumDecl.setEnumConstants(entries);
}
List<InterfaceRef> implems = new ArrayList<>();
if (enumeration.getImplements() != null) {
for (ClassOrInterfaceType obj : enumeration.getImplements()) {
InterfaceRef implInterface = new InterfaceRef(null, obj.toString());
implems.add(implInterface);
}
}
enumDecl.setImplementedInterfaces(implems);
List<Attribute> attributes = new ArrayList<>();
List<ConstructorDecl> constructors = new ArrayList<>();
List<Method> methods = new ArrayList<>();
if (td.getMembers() != null) {
for (BodyDeclaration bodyElmt : td.getMembers()) {
if (bodyElmt instanceof FieldDeclaration) { // attribute
FieldDeclaration fd = (FieldDeclaration) bodyElmt;
attributes.addAll(parseAttribute(fd));
this.loc++;
} else if (bodyElmt instanceof ConstructorDeclaration) { // constructor
ConstructorDeclaration cd = (ConstructorDeclaration) bodyElmt;
constructors.add(parseConstructor(cd, attributes, superClass.getClassName()));
this.loc++;
} else if (bodyElmt instanceof MethodDeclaration) { // method
MethodDeclaration md = (MethodDeclaration) bodyElmt;
methods.add(parseMethod(md, attributes));
this.loc++;
} else if (bodyElmt instanceof ClassOrInterfaceDeclaration) {
this.classes.add(parseClass((TypeDeclaration) bodyElmt));
this.loc++;
}
}
}
enumDecl.setAttributes(attributes);
enumDecl.setConstructors(constructors);
enumDecl.setMethods(methods);
return enumDecl;
}
示例9: visit
import com.github.javaparser.ast.body.EnumDeclaration; //导入方法依赖的package包/类
@Override public void visit(final EnumDeclaration n, final Object arg) {
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
printer.print("enum ");
printer.print(n.getName());
if (n.getImplements() != null) {
printer.print(" implements ");
for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.printLn(" {");
printer.indent();
if (n.getEntries() != null) {
printer.printLn();
for (final Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext();) {
final EnumConstantDeclaration e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
if (n.getMembers() != null) {
printer.printLn(";");
printMembers(n.getMembers(), arg);
} else {
if (n.getEntries() != null) {
printer.printLn();
}
}
printer.unindent();
printer.print("}");
}