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


Java ClassInstanceCreation.getExpression方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.ClassInstanceCreation.getExpression方法的典型用法代码示例。如果您正苦于以下问题:Java ClassInstanceCreation.getExpression方法的具体用法?Java ClassInstanceCreation.getExpression怎么用?Java ClassInstanceCreation.getExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.ClassInstanceCreation的用法示例。


在下文中一共展示了ClassInstanceCreation.getExpression方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endVisit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void endVisit(ClassInstanceCreation node) {
  Expression receiver = node.getExpression();
  Type createdType = node.getType();

  ConstraintVariable2 typeCv;
  if (node.getAnonymousClassDeclaration() == null) {
    typeCv = getConstraintVariable(createdType);
  } else {
    typeCv = fTCModel.makeImmutableTypeVariable(createdType.resolveBinding(), null);
    setConstraintVariable(createdType, typeCv);
  }
  setConstraintVariable(node, typeCv);

  IMethodBinding methodBinding = node.resolveConstructorBinding();
  Map<String, IndependentTypeVariable2> methodTypeVariables =
      createMethodTypeArguments(methodBinding);
  List<Expression> arguments = node.arguments();
  doVisitMethodInvocationArguments(
      methodBinding, arguments, receiver, methodTypeVariables, createdType);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:InferTypeArgumentsConstraintCreator.java

示例2: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public boolean visit(final ClassInstanceCreation node) {
	Assert.isNotNull(node);
	if (fCreateInstanceField) {
		final AST ast= node.getAST();
		final Type type= node.getType();
		final ITypeBinding binding= type.resolveBinding();
		if (binding != null && binding.getDeclaringClass() != null && !Bindings.equals(binding, fTypeBinding) && fSourceRewrite.getRoot().findDeclaringNode(binding) != null) {
			if (!Modifier.isStatic(binding.getModifiers())) {
				Expression expression= null;
				if (fCodeGenerationSettings.useKeywordThis || fEnclosingInstanceFieldName.equals(fNameForEnclosingInstanceConstructorParameter)) {
					final FieldAccess access= ast.newFieldAccess();
					access.setExpression(ast.newThisExpression());
					access.setName(ast.newSimpleName(fEnclosingInstanceFieldName));
					expression= access;
				} else
					expression= ast.newSimpleName(fEnclosingInstanceFieldName);
				if (node.getExpression() != null)
					fSourceRewrite.getImportRemover().registerRemovedNode(node.getExpression());
				fSourceRewrite.getASTRewrite().set(node, ClassInstanceCreation.EXPRESSION_PROPERTY, expression, fGroup);
			} else
				addTypeQualification(type, fSourceRewrite, fGroup);
		}
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:MoveInnerToTopRefactoring.java

示例3: endVisit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void endVisit(ClassInstanceCreation node) {
	Expression receiver= node.getExpression();
	Type createdType= node.getType();

	ConstraintVariable2 typeCv;
	if (node.getAnonymousClassDeclaration() == null) {
		typeCv= getConstraintVariable(createdType);
	} else {
		typeCv= fTCModel.makeImmutableTypeVariable(createdType.resolveBinding(), null);
		setConstraintVariable(createdType, typeCv);
	}
	setConstraintVariable(node, typeCv);

	IMethodBinding methodBinding= node.resolveConstructorBinding();
	Map<String, IndependentTypeVariable2> methodTypeVariables= createMethodTypeArguments(methodBinding);
	List<Expression> arguments= node.arguments();
	doVisitMethodInvocationArguments(methodBinding, arguments, receiver, methodTypeVariables, createdType);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:InferTypeArgumentsConstraintCreator.java

示例4: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public boolean visit(ClassInstanceCreation node) {
  if (fTypeCounter == 0) {
    Expression receiver = node.getExpression();
    if (receiver == null) {
      if (node.resolveTypeBinding().isLocal()) fImplicitReceivers.add(node);
    }
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:SourceAnalyzer.java

示例5: updateConstructorReference

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
private void updateConstructorReference(final ClassInstanceCreation creation, final CompilationUnitRewrite targetRewrite, final ICompilationUnit unit, TextEditGroup group) throws JavaModelException {
	Assert.isNotNull(creation);
	Assert.isNotNull(targetRewrite);
	Assert.isNotNull(unit);
	final ASTRewrite rewrite= targetRewrite.getASTRewrite();
	if (fCreateInstanceField)
		insertExpressionAsParameter(creation, rewrite, unit, group);
	final Expression expression= creation.getExpression();
	if (expression != null) {
		rewrite.remove(expression, null);
		targetRewrite.getImportRemover().registerRemovedNode(expression);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:MoveInnerToTopRefactoring.java

示例6: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public boolean visit(ClassInstanceCreation node) {
	if (fTypeCounter == 0) {
		Expression receiver= node.getExpression();
		if (receiver == null) {
			if (node.resolveTypeBinding().isLocal())
				fImplicitReceivers.add(node);
		}
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:SourceAnalyzer.java

示例7: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public boolean visit(ClassInstanceCreation node) {
	if (node.getExpression() != null) {
		node.getExpression().accept(this);
		this.fBuffer.append(".");//$NON-NLS-1$
	}
	this.fBuffer.append("new ");//$NON-NLS-1$
	if (node.getAST().apiLevel() >= JLS3) {
		if (!node.typeArguments().isEmpty()) {
			this.fBuffer.append("<");//$NON-NLS-1$
			for (Iterator<Type> it= node.typeArguments().iterator(); it.hasNext();) {
				Type t= it.next();
				t.accept(this);
				if (it.hasNext()) {
					this.fBuffer.append(",");//$NON-NLS-1$
				}
			}
			this.fBuffer.append(">");//$NON-NLS-1$
		}
		node.getType().accept(this);
	}
	this.fBuffer.append("(");//$NON-NLS-1$
	for (Iterator<Expression> it= node.arguments().iterator(); it.hasNext();) {
		Expression e= it.next();
		e.accept(this);
		if (it.hasNext()) {
			this.fBuffer.append(",");//$NON-NLS-1$
		}
	}
	this.fBuffer.append(")");//$NON-NLS-1$
	if (node.getAnonymousClassDeclaration() != null) {
		node.getAnonymousClassDeclaration().accept(this);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:36,代码来源:ASTFlattener.java

示例8: visit

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
public boolean visit(ClassInstanceCreation node) {
	if (node.getExpression() != null) {
		node.getExpression().accept(this);
		this.buffer.append(".");//$NON-NLS-1$
	}
	this.buffer.append("new ");//$NON-NLS-1$
	if (node.getAST().apiLevel() == JLS2) {
		getName(node).accept(this);
	}
	if (node.getAST().apiLevel() >= JLS3) {
		if (!node.typeArguments().isEmpty()) {
			this.buffer.append("<");//$NON-NLS-1$
			for (Iterator it = node.typeArguments().iterator(); it.hasNext(); ) {
				Type t = (Type) it.next();
				t.accept(this);
				if (it.hasNext()) {
					this.buffer.append(",");//$NON-NLS-1$
				}
			}
			this.buffer.append(">");//$NON-NLS-1$
		}
		node.getType().accept(this);
	}
	this.buffer.append("(");//$NON-NLS-1$
	for (Iterator it = node.arguments().iterator(); it.hasNext(); ) {
		Expression e = (Expression) it.next();
		e.accept(this);
		if (it.hasNext()) {
			this.buffer.append(",");//$NON-NLS-1$
		}
	}
	this.buffer.append(")");//$NON-NLS-1$
	if (node.getAnonymousClassDeclaration() != null) {
		node.getAnonymousClassDeclaration().accept(this);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:38,代码来源:NaiveASTFlattener.java

示例9: write

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void write(ASTNode node) {
	ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;

	//TODO: Handle type arguments
	//TODO: Handle different reference operator used for stack objects

	// TODO: Support inner class creation via object.new
	if (classInstanceCreation.getExpression() != null)
		throw sourceNotSupported("Inner classes not yet supported");

	matchAndWrite("new");
	copySpaceAndComments();

       swiftASTWriters.writeNode(classInstanceCreation.getType());
	copySpaceAndComments();

	matchAndWrite("(");
	copySpaceAndComments();

	List<?> arguments = classInstanceCreation.arguments();

	boolean first = true;
	for (Object object : arguments) {
		Expression argument = (Expression) object;

		if (! first) {
			matchAndWrite(",");
			copySpaceAndComments();
		}

           swiftASTWriters.writeNode(argument);
		copySpaceAndComments();

		first = false;
	}

	matchAndWrite(")");
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:40,代码来源:ClassInstanceCreationWriter.java

示例10: write

import org.eclipse.jdt.core.dom.ClassInstanceCreation; //导入方法依赖的package包/类
@Override
public void write(ClassInstanceCreation classInstanceCreation) {
	//TODO: Handle type arguments
	//TODO: Handle different reference operator used for stack objects

	// TODO: Support inner class creation via object.new
	if (classInstanceCreation.getExpression() != null)
		throw sourceNotSupported("Inner classes not yet supported");

	matchAndWrite("new");
	copySpaceAndComments();

       writeNode(classInstanceCreation.getType());
	copySpaceAndComments();

	matchAndWrite("(");
	copySpaceAndComments();

	List<?> arguments = classInstanceCreation.arguments();

	boolean first = true;
	for (Object object : arguments) {
		Expression argument = (Expression) object;

		if (! first) {
			matchAndWrite(",");
			copySpaceAndComments();
		}

           writeNode(argument);
		copySpaceAndComments();

		first = false;
	}

	matchAndWrite(")");
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:38,代码来源:ClassInstanceCreationWriter.java


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