当前位置: 首页>>代码示例>>Java>>正文


Java EnumConstantDeclaration类代码示例

本文整理汇总了Java中com.github.javaparser.ast.body.EnumConstantDeclaration的典型用法代码示例。如果您正苦于以下问题:Java EnumConstantDeclaration类的具体用法?Java EnumConstantDeclaration怎么用?Java EnumConstantDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EnumConstantDeclaration类属于com.github.javaparser.ast.body包,在下文中一共展示了EnumConstantDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateNormalEnum

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
/**
 * Generate the enum unless it already exists.
 * @param values
 */
private ClassWrapper generateNormalEnum(List<String> values) {
	String name = m_classWrapper.getSimpleName() + AbstractGenerator.capitalizeFirst(getPropertyName());
	ClassWrapper enumWrapper = g().findClassWrapper(m_classWrapper.getPackageName(), name);
	if(null != enumWrapper) {
		return enumWrapper;
	}

	//--
	enumWrapper = g().createEnumWrapper(m_classWrapper.getPackageName(), name);
	EnumDeclaration et = enumWrapper.getEnumType();

	for(String value : values) {
		EnumConstantDeclaration ec = et.addEnumConstant(value);
	}
	return enumWrapper;
}
 
开发者ID:fjalvingh,项目名称:domui,代码行数:21,代码来源:ColumnWrapper.java

示例2: generateCodeEnum

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
/**
 * Generate the enum unless it already exists.
 * @param values
 */
private ClassWrapper generateCodeEnum(List<String> values) {
	String name = m_classWrapper.getSimpleName() + AbstractGenerator.capitalizeFirst(getPropertyName());
	ClassWrapper enumWrapper = g().findClassWrapper(m_classWrapper.getPackageName(), name);
	if(null != enumWrapper) {
		return enumWrapper;
	}

	//--
	enumWrapper = g().createEnumWrapper(m_classWrapper.getPackageName(), name);
	EnumDeclaration et = enumWrapper.getEnumType();

	for(String value : values) {
		EnumConstantDeclaration ec = et.addEnumConstant(AbstractGenerator.camelCase(value));
		ec.setJavadocComment("Enum value for '" + value + "'");
	}
	return enumWrapper;
}
 
开发者ID:fjalvingh,项目名称:domui,代码行数:22,代码来源:ColumnWrapper.java

示例3: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override
public final void visit(final EnumConstantDeclaration ctx, Object arg) {

    final Component enumConstCmp = createComponent(ctx, OOPSourceModelConstants.ComponentType.ENUM_CONSTANT);
    enumConstCmp.setName(ctx.getNameAsString());
    enumConstCmp.setComponentName(generateComponentName(ctx.getNameAsString()));
    pointParentsToGivenChild(enumConstCmp);
    for (final AnnotationExpr annot : ctx.getAnnotations()) {
        populateAnnotation(enumConstCmp, annot);
    }
    if (ctx.getComment().isPresent()) {
        enumConstCmp.setComment(ctx.getComment().get().toString());
    }
    componentStack.push(enumConstCmp);
    super.visit(ctx, arg);
    completeComponent();
}
 
开发者ID:Zir0-93,项目名称:clarpse,代码行数:18,代码来源:JavaTreeListener.java

示例4: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override
public void visit(final EnumConstantDeclaration n, final Object arg) {
    printer.printLn("EnumConstantDeclaration");
    printJavaComment(n.getComment(), arg);
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printer.print(n.getName());

    if (n.getArgs() != null) {
        printArguments(n.getArgs(), arg);
    }

    if (n.getClassBody() != null) {
        printer.printLn(" {");
        printer.indent();
        printMembers(n.getClassBody(), arg);
        printer.unindent();
        printer.printLn("}");
    }
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:21,代码来源:ASTDumpVisitor.java

示例5: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public Boolean visit(final EnumConstantDeclaration n1, final Node arg) {
	final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg;

	// javadoc are checked at CompilationUnit

	if (!objEquals(n1.getName(), n2.getName())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
		return Boolean.FALSE;
	}

	return Boolean.TRUE;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:24,代码来源:EqualsVisitor.java

示例6: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override
public Node visit(EnumDeclaration _n, Object _arg) {
	JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
	List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
	List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
	List<EnumConstantDeclaration> entries = visit(_n.getEntries(), _arg);
	List<BodyDeclaration> members = visit(_n.getMembers(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	EnumDeclaration r = new EnumDeclaration(
			_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
			 _n.getModifiers(), annotations, _n.getName(), implementsList, entries, members
	);
	r.setComment(comment);
	return r;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:17,代码来源:CloneVisitor.java

示例7: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public void visit(final EnumConstantDeclaration n, final Object arg) {
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printer.print(n.getName());

if (n.getArgs() != null) {
    printArguments(n.getArgs(), arg);
}

if (!n.getClassBody().isEmpty()) {
    printer.printLn(" {");
    printer.indent();
    printMembers(n.getClassBody(), arg);
    printer.unindent();
    printer.printLn("}");
}
   }
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:19,代码来源:DumpVisitor.java

示例8: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public void visit(final EnumConstantDeclaration 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.getArgs() != null) {
		for (final Expression e : n.getArgs()) {
			e.accept(this, arg);
		}
	}
	if (n.getClassBody() != null) {
		for (final BodyDeclaration member : n.getClassBody()) {
			member.accept(this, arg);
		}
	}
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:22,代码来源:VoidVisitorAdapter.java

示例9: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public void visit(final EnumConstantDeclaration 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.getArgs() != null) {
        for (final Expression e : n.getArgs()) {
            e.accept(this, arg);
        }
    }
    if (n.getClassBody() != null) {
        for (final BodyDeclaration member : n.getClassBody()) {
            member.accept(this, arg);
        }
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:23,代码来源:JsonVisitorAdapter.java

示例10: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public Boolean visit(final EnumConstantDeclaration n1, final Node arg) {
	final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg;

	// javadoc are checked at CompilationUnit

	if (!objEquals(n1.getName(), n2.getName())) {
		return false;
	}

	if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
		return false;
	}

	if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
		return false;
	}

	if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
		return false;
	}

	return true;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:24,代码来源:EqualsVisitor.java

示例11: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的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);
		}
	}
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:21,代码来源:VoidVisitorAdapter.java

示例12: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public Node visit(final EnumConstantDeclaration 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<Expression> args = n.getArgs();
	if (args != null) {
		for (int i = 0; i < args.size(); i++) {
			args.set(i, (Expression) args.get(i).accept(this, arg));
		}
		removeNulls(args);
	}
       final List<BodyDeclaration<?>> classBody = n.getClassBody();
	if (classBody != null) {
		for (int i = 0; i < classBody.size(); i++) {
               classBody.set(i, (BodyDeclaration<?>) classBody.get(i).accept(this, arg));
		}
		removeNulls(classBody);
	}
	return n;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:26,代码来源:ModifierVisitorAdapter.java

示例13: solveSymbol

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override
public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
    if (typeSolver == null) throw new IllegalArgumentException();

    // among constants
    for (EnumConstantDeclaration constant : wrappedNode.getEntries()) {
        if (constant.getName().getId().equals(name)) {
            return SymbolReference.solved(new JavaParserEnumConstantDeclaration(constant, typeSolver));
        }
    }

    if (this.getDeclaration().hasField(name)) {
        return SymbolReference.solved(this.getDeclaration().getField(name));
    }

    // then to parent
    return getParent().solveSymbol(name, typeSolver);
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:19,代码来源:EnumDeclarationContext.java

示例14: visit

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override public void visit(final EnumConstantDeclaration n, final Object arg) {
	printJavaComment(n.getComment(), arg);
	printJavadoc(n.getJavaDoc(), arg);
	printMemberAnnotations(n.getAnnotations(), arg);
	printer.print(n.getName());

	if (n.getArgs() != null) {
		printArguments(n.getArgs(), arg);
	}

	if (n.getClassBody() != null) {
		printer.printLn(" {");
		printer.indent();
		printMembers(n.getClassBody(), arg);
		printer.unindent();
		printer.printLn("}");
	}
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:19,代码来源:DumpVisitor.java

示例15: solveSymbol

import com.github.javaparser.ast.body.EnumConstantDeclaration; //导入依赖的package包/类
@Override
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
    if (typeSolver == null) throw new IllegalArgumentException();

    // among constants
    for (EnumConstantDeclaration constant : wrappedNode.getEntries()) {
        if (constant.getName().getId().equals(name)) {
            return SymbolReference.solved(new JavaParserEnumConstantDeclaration(constant, typeSolver));
        }
    }

    if (this.getDeclaration().hasField(name)) {
        return SymbolReference.solved(this.getDeclaration().getField(name));
    }

    // then to parent
    return getParent().solveSymbol(name, typeSolver);
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:19,代码来源:EnumDeclarationContext.java


注:本文中的com.github.javaparser.ast.body.EnumConstantDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。