本文整理汇总了Java中com.github.javaparser.ast.body.VariableDeclaratorId类的典型用法代码示例。如果您正苦于以下问题:Java VariableDeclaratorId类的具体用法?Java VariableDeclaratorId怎么用?Java VariableDeclaratorId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VariableDeclaratorId类属于com.github.javaparser.ast.body包,在下文中一共展示了VariableDeclaratorId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
public void visit(MethodDeclaration n, Object arg) {
MethodDVO methodDVO = new MethodDVO();
methodDVO.setMethodName(n.getName());
methodDVO.setVisivility(GargoyleJavaParser.toStringVisibility(n.getModifiers()));
methodDVO.setDescription(n.getComment() != null ? n.getComment().toString() : "");
ArrayList<MethodParameterDVO> methodParameterDVOList = new ArrayList<>();
methodDVO.setMethodParameterDVOList(methodParameterDVOList);
List<Parameter> parameters = n.getParameters();
for (Parameter p : parameters) {
// String string2 = p.toString();
VariableDeclaratorId id2 = p.getId();
String varName = id2.getName();
Type type = p.getType();
String typeName = type.toString();
Comment comment = p.getComment();
methodParameterDVOList.add(new MethodParameterDVO(varName, typeName, "", comment == null ? "" : comment.toString()));
}
onMethodDVOVisite.accept(methodDVO);
super.visit(n, arg);
}
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:BaseInfoComposite.java
示例2: getCreateInputSocketsMethod
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
/**
* Creates the method that returns the input socket of this operation.
*
* @return The method declaration.
*/
private MethodDeclaration getCreateInputSocketsMethod() {
return new MethodDeclaration(
ModifierSet.PUBLIC,
Arrays.asList(OVERRIDE_ANNOTATION, SUPPRESS_ANNOTATION),
null,
SocketHintDeclarationCollection.getSocketReturnParam("InputSocket"),
"createInputSockets",
Collections.singletonList(
new Parameter(createReferenceType("EventBus", 0), new VariableDeclaratorId("eventBus"))
),
0,
null,
socketHintDeclarationCollection.getInputSocketBody()
);
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:21,代码来源:Operation.java
示例3: getCreateOutputSocketsMethod
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
/**
* Creates the method that returns the output sockets of this operation.
*
* @return The method declaration.
*/
private MethodDeclaration getCreateOutputSocketsMethod() {
return new MethodDeclaration(
ModifierSet.PUBLIC,
Arrays.asList(OVERRIDE_ANNOTATION, SUPPRESS_ANNOTATION),
null,
SocketHintDeclarationCollection.getSocketReturnParam("OutputSocket"),
"createOutputSockets",
Collections.singletonList(
new Parameter(createReferenceType("EventBus", 0), new VariableDeclaratorId("eventBus"))
),
0,
null,
socketHintDeclarationCollection.getOutputSocketBody()
);
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:21,代码来源:Operation.java
示例4: getPerformMethod
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
private MethodDeclaration getPerformMethod() {
String inputParamId = "inputs";
String outputParamId = "outputs";
return new MethodDeclaration(
ModifierSet.PUBLIC,
Arrays.asList(OVERRIDE_ANNOTATION),
null,
new VoidType(),
"perform",
Arrays.asList(
new Parameter(SocketHintDeclarationCollection.getSocketReturnParam("InputSocket"),
new VariableDeclaratorId(inputParamId)),
new Parameter(SocketHintDeclarationCollection.getSocketReturnParam("OutputSocket"),
new VariableDeclaratorId(outputParamId))
),
0,
null,
new BlockStmt(
getPerformExpressionList(inputParamId, outputParamId)
)
);
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:23,代码来源:Operation.java
示例5: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override
public Node visit(Parameter _n, Object _arg) {
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
Type<?> type_ = cloneNodes(_n.getElementType(), _arg);
VariableDeclaratorId id = cloneNodes(_n.getId(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
List<ArrayBracketPair> arrayBracketPairsAfterType_ = visit(_n.getArrayBracketPairsAfterElementType(), _arg);
Parameter r = new Parameter(
_n.getRange(),
_n.getModifiers(),
annotations,
type_,
arrayBracketPairsAfterType_,
_n.isVarArgs(),
id
);
r.setComment(comment);
return r;
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:21,代码来源:CloneVisitor.java
示例6: getParamTypes
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
private ArrayList<String> getParamTypes(Node n){
ArrayList<String> paramTypes = new ArrayList<String>();
List<Parameter> params = new ArrayList<Parameter>();
if(n instanceof MethodDeclaration){
params = ((MethodDeclaration) n).getParameters();
}else if(n instanceof ConstructorDeclaration){
params = ((ConstructorDeclaration) n).getParameters();
}
for (Parameter param : params) {
boolean isArray = false;
for(Node node : param.getChildrenNodes()){
if(node instanceof VariableDeclaratorId){
VariableDeclaratorId id = (VariableDeclaratorId) node;
if(id.getArrayCount() > 0){
// This would be the case when var's are declared like String args[], but we want to extract String [] as parameter
isArray = true;
}
}
}
if(isArray){
paramTypes.add(param.getType().toString() + "[]");
}
else{
paramTypes.add(param.getType().toString());
}
}
return paramTypes;
}
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:32,代码来源:ASTEnhanced.java
示例7: parseNode
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
private void parseNode(Node node) {
// Capture all types of Expressions and Statements
if(node instanceof Expression){
incrementDictCount(this.expressions, node.getClass().getSimpleName());
} else if(node instanceof Statement){
incrementDictCount(this.statements, node.getClass().getSimpleName());
}
if(node instanceof ClassOrInterfaceDeclaration){
this.concepts.add("InnerClass");
}
else if(node instanceof MethodDeclaration){
this.concepts.add("InnerMethod");
}
if (node instanceof VariableDeclaratorId){
incrementDictCount(this.variables, ((VariableDeclaratorId) node).getName());
} else if (node instanceof MethodCallExpr) {
this.parseMethodCall((MethodCallExpr) node);
} else if (node instanceof Expression) {
this.parseExpr((Expression) node);
} else if(node instanceof CatchClause){
CatchClause catchClause = (CatchClause) node;
this.exceptions.add(catchClause.getParam().getType().toString());
} else if(node instanceof ThrowStmt){
Expression exp = ((ThrowStmt) node).getExpr();
List<Node> childNodes = exp.getChildrenNodes();
if(childNodes.size() > 1){
this.exceptions.add(childNodes.get(0).toString());
}
}
for(Node childNode : node.getChildrenNodes()){
parseNode(childNode);
}
}
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:38,代码来源:ASTEnhanced.java
示例8: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override
public void visit(final VariableDeclaratorId n, final Object arg) {
printer.printLn("VariableDeclaratorId");
printJavaComment(n.getComment(), arg);
printer.print(n.getName());
for (int i = 0; i < n.getArrayCount(); i++) {
printer.print("[]");
}
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:10,代码来源:ASTDumpVisitor.java
示例9: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override
public JCTree visit(final VariableDeclaratorId n, final Object arg) {
//ARG0: Name name
Name arg0 = names.fromString(n.getName());
return new AJCIdent(make.Ident(arg0), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:JavaParser2JCTree.java
示例10: doIsEquals
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean doIsEquals(MultiTypeParameter first, MultiTypeParameter second) {
if(!getMerger(VariableDeclaratorId.class).isEquals(first.getId(),second.getId())) return false;
List<Type> firstTypes = first.getTypes();
List<Type> secondTypes = second.getTypes();
if(firstTypes == null) return secondTypes == null;
if(secondTypes == null) return false;
if(firstTypes.size() != secondTypes.size()) return false;
for(Type ft : firstTypes){
boolean found = false;
AbstractMerger merger = getMerger(ft.getClass());
for(Type st : secondTypes){
if(merger.isEquals(ft, st)){
found = true; break;
}
}
if(!found) return false;
}
return true;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:28,代码来源:MultiTypeParameterMerger.java
示例11: CatchClause
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
public CatchClause(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final int exceptModifier, final List<AnnotationExpr> exceptAnnotations, final Type exceptTypes,
final VariableDeclaratorId exceptId, final BlockStmt catchBlock) {
super(beginLine, beginColumn, endLine, endColumn);
setParam(new Parameter(beginLine, beginColumn, endLine, endColumn, exceptModifier, exceptAnnotations, exceptTypes, false, exceptId));
setCatchBlock(catchBlock);
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:8,代码来源:CatchClause.java
示例12: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override public Boolean visit(final VariableDeclaratorId n1, final Node arg) {
final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
return Boolean.FALSE;
}
if (!objEquals(n1.getName(), n2.getName())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:14,代码来源:EqualsVisitor.java
示例13: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override
public Node visit(VariableDeclarator _n, Object _arg) {
VariableDeclaratorId id = cloneNodes(_n.getId(), _arg);
Expression init = cloneNodes(_n.getInit(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclarator r = new VariableDeclarator(
_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
id, init
);
r.setComment(comment);
return r;
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:14,代码来源:CloneVisitor.java
示例14: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override public void visit(final VariableDeclaratorId n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print(n.getName());
for (int i = 0; i < n.getArrayCount(); i++) {
printer.print("[]");
}
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:8,代码来源:DumpVisitor.java
示例15: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
protected Node visit(final BaseParameter n, final A 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);
}
n.setId((VariableDeclaratorId) n.getId().accept(this, arg));
return n;
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:13,代码来源:ModifierVisitorAdapter.java
示例16: generateEnum
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
/**
* Generates the enumeration class body.
*
* @return The generated Enumeration
*/
private EnumDeclaration generateEnum() {
final String valueString = "value";
// Create new Enum
EnumDeclaration newEnum = new EnumDeclaration(
ModifierSet.PUBLIC,
null,
getEnumerationClassName(),
null,
generateEnumConstantDeclarations(),
null
);
// Add a field value for the public final value variable
FieldDeclaration valueField = new FieldDeclaration(
ModifierSet.addModifier(ModifierSet.FINAL, ModifierSet.PUBLIC),
ASTHelper.INT_TYPE,
Collections.singletonList(
new VariableDeclarator(new VariableDeclaratorId(valueString))
));
ASTHelper.addMember(newEnum, valueField);
// Add the constructor to take the opencv value
ConstructorDeclaration enumConstructor = new ConstructorDeclaration(
0,
null,
null,
name,
Collections.singletonList(
ASTHelper.createParameter(ASTHelper.INT_TYPE, valueString)
),
null,
getDefaultConstructorBlockStatement(valueString)
);
ASTHelper.addMember(newEnum, enumConstructor);
return newEnum;
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:41,代码来源:Enumeration.java
示例17: SocketHintDeclaration
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
public SocketHintDeclaration(DefaultValueCollector collector, Type genericType, List<String>
hintNames, boolean isOutput) {
this.genericType = genericType;
this.paramTypes = hintNames.stream().map(n -> new DefinedParamType(
genericType.toStringWithoutComments(),
new Parameter(genericType, new VariableDeclaratorId(n)))
).collect(Collectors.toList());
this.isOutput = isOutput;
this.collector = collector;
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:11,代码来源:SocketHintDeclaration.java
示例18: getDeclaration
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
/**
* Creates a socket hint declaration from the constructor.
*
* @return The field declaration
*/
public FieldDeclaration getDeclaration() {
final int modifiers = ModifierSet.addModifier(ModifierSet.FINAL, ModifierSet.PRIVATE);
final ClassOrInterfaceType socketHintType = new ClassOrInterfaceType(SOCKET_HINT_CLASS_NAME);
socketHintType.setTypeArgs(Collections.singletonList(genericType));
final ClassOrInterfaceType socketHintBuilderType = new ClassOrInterfaceType(new
ClassOrInterfaceType(SOCKET_HINT_CLASS_NAME), SOCKET_HINT_BUILDER_CLASS_NAME);
final List<VariableDeclarator> variableDeclarations = new ArrayList<>();
for (DefinedParamType paramType : paramTypes) {
// Don't generate hint for ignored param
if (paramType.isIgnored()) {
continue;
}
String hintName = paramType.getName();
// The variableId
final String fullHintName = hintName
+ (isOutput() ? OUTPUT_POSTFIX : INPUT_POSTFIX)
+ HINT_POSTFIX;
// The name hint of the socket hint
final StringLiteralExpr stringLiteralExpr = new StringLiteralExpr(hintName);
variableDeclarations.add(
new VariableDeclarator(
new VariableDeclaratorId(fullHintName),
// Create new instantiation of type socket hint type
socketHintBuilder(socketHintBuilderType, stringLiteralExpr, paramType)
)
);
}
if (variableDeclarations.isEmpty()) {
return null;
}
return new FieldDeclaration(modifiers, socketHintType, variableDeclarations);
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:44,代码来源:SocketHintDeclaration.java
示例19: CatchClause
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
public CatchClause(final Range range,
final EnumSet<Modifier> exceptModifier,
final List<AnnotationExpr> exceptAnnotations,
final Type exceptType,
final VariableDeclaratorId exceptId,
final BlockStmt catchBlock) {
super(range);
setParam(new Parameter(range, exceptModifier, exceptAnnotations, exceptType, null, false, exceptId));
setBody(catchBlock);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:11,代码来源:CatchClause.java
示例20: visit
import com.github.javaparser.ast.body.VariableDeclaratorId; //导入依赖的package包/类
@Override public Boolean visit(final VariableDeclaratorId n1, final Node arg) {
final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
if(!nodesEquals(n1.getArrayBracketPairsAfterId(), n2.getArrayBracketPairsAfterId())){
return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
return false;
}
return true;
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:14,代码来源:EqualsVisitor.java
注:本文中的com.github.javaparser.ast.body.VariableDeclaratorId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论