本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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(")");
}
示例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(")");
}