本文整理汇总了Java中com.github.javaparser.ast.body.ConstructorDeclaration.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java ConstructorDeclaration.getParameters方法的具体用法?Java ConstructorDeclaration.getParameters怎么用?Java ConstructorDeclaration.getParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.body.ConstructorDeclaration
的用法示例。
在下文中一共展示了ConstructorDeclaration.getParameters方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration n, final A arg) {
visitComment(n.getComment(), arg);
visitAnnotations(n, arg);
if (n.getTypeParameters() != null) {
for (final TypeParameter t : n.getTypeParameters()) {
t.accept(this, arg);
}
}
n.getNameExpr().accept(this, arg);
if (n.getParameters() != null) {
for (final Parameter p : n.getParameters()) {
p.accept(this, arg);
}
}
if (n.getThrows() != null) {
for (final ReferenceType name : n.getThrows()) {
name.accept(this, arg);
}
}
n.getBody().accept(this, arg);
}
示例2: processConstructor
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
private void processConstructor(JavaUnit java, ConstructorDeclaration c, int i) throws IOException {
DefaultJavaElement element=new DefaultJavaElement();
boolean isStarted=false;
for(;lineNum<i;lineNum++){
String line=reader.readLine();
if(StringUtils.isBlank(line) && !isStarted){
continue;
}
if(isStarted==false){
element.addContent(line.trim());
}else{
element.addContent(line);
}
isStarted=true;
}
JavaConstructor jm=new JavaConstructor();
if(c.getParameters()!=null){
for(Parameter param:c.getParameters()){
jm.addparam(param.getType().toString(), param.getId().getName(),param.getModifiers());
if(param.isVarArgs()){
jm.setVarArg(true);
}
}
}
java.addMethod(jm.getKey(), element);
}
示例3: ConstructorNode
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public ConstructorNode(ConstructorDeclaration conDec)
{
super();
this.conDec = conDec;
if(conDec.isPrivate())
modifier = "- ";
else if(conDec.isPublic())
modifier = "+ ";
else if(conDec.isProtected())
modifier = "# ";
else
modifier = "~ ";
nodeName = modifier + conDec.getName() + "(";
if( conDec.getParameters() != null )
{
parameters = new ArrayList<Parameter>(conDec.getParameters());
for( Parameter p : parameters )
{
nodeName = nodeName + " " + p + ", ";
}
if( nodeName.lastIndexOf(',') > 0 )
{
nodeName = nodeName.substring(0, nodeName.lastIndexOf(','));
}
}
nodeName = nodeName + ")";
}
示例4: index
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
public void index(ConstructorDeclaration constructorDeclaration, int typeId) {
List<Parameter> parameters = constructorDeclaration.getParameters();
String name = constructorDeclaration.getNameAsString();
int methodId = methodDao.save(new Method(name,
constructorDeclaration.isPublic(), constructorDeclaration.isStatic(), constructorDeclaration.isFinal(), constructorDeclaration.isAbstract(), true, typeId));
for (Parameter parameter : parameters) {
parameterIndexer.index(parameter, methodId);
}
}
示例5: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public void visit(final ConstructorDeclaration n, final Object arg) {
printer.printLn("ConstructorDeclaration");
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
printTypeParameters(n.getTypeParameters(), arg);
if (n.getTypeParameters() != null) {
printer.print(" ");
}
printer.print(n.getName());
printer.print("(");
if (n.getParameters() != null) {
for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext(); ) {
final Parameter p = i.next();
p.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(")");
if (!isNullOrEmpty(n.getThrows())) {
printer.print(" throws ");
for (final Iterator<NameExpr> i = n.getThrows().iterator(); i.hasNext(); ) {
final NameExpr name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(" ");
n.getBlock().accept(this, arg);
}
示例6: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public Node visit(final ConstructorDeclaration n, final Object arg) {
ConstructorDeclaration myret = (ConstructorDeclaration) super.visit(n, arg);
List<Parameter> parameters = n.getParameters();
// I'd write short-circuit expression with ||,
// but someone whom uses Eclipse would complain.
if (parameters == null) {
founddefault = true;
} else if (parameters.size() == 0) {
founddefault = true;
}
return myret;
}
示例7: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration 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.getTypeParameters() != null) {
for (final TypeParameter t : n.getTypeParameters()) {
t.accept(this, arg);
}
}
if (n.getParameters() != null) {
for (final Parameter p : n.getParameters()) {
p.accept(this, arg);
}
}
if (n.getThrows() != null) {
for (final NameExpr name : n.getThrows()) {
name.accept(this, arg);
}
}
n.getBlock().accept(this, arg);
}
示例8: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration 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.getTypeParameters() != null) {
for (final TypeParameter t : n.getTypeParameters()) {
t.accept(this, arg);
}
}
if (n.getParameters() != null) {
for (final Parameter p : n.getParameters()) {
p.accept(this, arg);
}
}
if (n.getThrows() != null) {
for (final NameExpr name : n.getThrows()) {
name.accept(this, arg);
}
}
n.getBlock().accept(this, arg);
}
示例9: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final ConstructorDeclaration 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<TypeParameter> typeParameters = n.getTypeParameters();
if (typeParameters != null) {
for (int i = 0; i < typeParameters.size(); i++) {
typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg));
}
removeNulls(typeParameters);
}
final List<Parameter> parameters = n.getParameters();
if (parameters != null) {
for (int i = 0; i < parameters.size(); i++) {
parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
}
removeNulls(parameters);
}
final List<NameExpr> throwz = n.getThrows();
if (throwz != null) {
for (int i = 0; i < throwz.size(); i++) {
throwz.set(i, (NameExpr) throwz.get(i).accept(this, arg));
}
removeNulls(throwz);
}
n.setBlock((BlockStmt) n.getBlock().accept(this, arg));
return n;
}
示例10: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public Node visit(final ConstructorDeclaration 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<TypeParameter> typeParameters = n.getTypeParameters();
if (typeParameters != null) {
for (int i = 0; i < typeParameters.size(); i++) {
typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg));
}
removeNulls(typeParameters);
}
final List<Parameter> parameters = n.getParameters();
if (parameters != null) {
for (int i = 0; i < parameters.size(); i++) {
parameters.set(i, (Parameter) parameters.get(i).accept(this, arg));
}
removeNulls(parameters);
}
final List<ReferenceType> throwz = n.getThrows();
if (throwz != null) {
for (int i = 0; i < throwz.size(); i++) {
throwz.set(i, (ReferenceType) throwz.get(i).accept(this, arg));
}
removeNulls(throwz);
}
n.setBody((BlockStmt) n.getBody().accept(this, arg));
return n;
}
示例11: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override public void visit(final ConstructorDeclaration n, final Object arg) {
printJavaComment(n.getComment(), arg);
printJavadoc(n.getJavaDoc(), arg);
printMemberAnnotations(n.getAnnotations(), arg);
printModifiers(n.getModifiers());
printTypeParameters(n.getTypeParameters(), arg);
if (n.getTypeParameters() != null) {
printer.print(" ");
}
printer.print(n.getName());
printer.print("(");
if (n.getParameters() != null) {
for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
final Parameter p = i.next();
p.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(")");
if (!isNullOrEmpty(n.getThrows())) {
printer.print(" throws ");
for (final Iterator<NameExpr> i = n.getThrows().iterator(); i.hasNext();) {
final NameExpr name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(" ");
n.getBlock().accept(this, arg);
}
示例12: visit
import com.github.javaparser.ast.body.ConstructorDeclaration; //导入方法依赖的package包/类
@Override
public JCTree visit(final ConstructorDeclaration 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
// Names already has the name for this
Name arg1 = names.names.init;
//ARG2: JCExpression restype
JCExpression arg2 = null;
//ARG3: List<JCTypeParameter> typaramsList
List<JCTypeParameter> arg3 = List.<JCTypeParameter>nil();
if (n.getTypeParameters() != null) {
for (final TypeParameter t : n.getTypeParameters()) {
arg3 = arg3.append((JCTypeParameter) t.accept(this, arg));
}
}
//ARG4: List<JCVariableDecl> params
List<JCVariableDecl> arg4 = List.<JCVariableDecl>nil();
if (n.getParameters() != null) {
for (final Parameter p : n.getParameters()) {
arg4 = arg4.append((JCVariableDecl) p.accept(this, arg));
}
}
//ARG5: List<JCExpression> thrown
List<JCExpression> arg5 = List.<JCExpression>nil();
if (n.getThrows() != null) {
for (final NameExpr name : n.getThrows()) {
arg5 = arg5.append((JCExpression) name.accept(this, arg));
}
}
//ARG6: JCBlock body
JCBlock arg6 = (JCBlock) n.getBlock().accept(this, arg);
//ARG7: JCExpression defaultValue
JCExpression arg7 = null;
/* TODO - Javadoc and annotations not supported
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);
}
}
*/
return new AJCMethodDecl(make.MethodDef(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), ((n.getComment() != null) ? n.getComment().getContent() : null));
}