本文整理汇总了Java中org.eclipse.jdt.core.dom.TypeLiteral.setType方法的典型用法代码示例。如果您正苦于以下问题:Java TypeLiteral.setType方法的具体用法?Java TypeLiteral.setType怎么用?Java TypeLiteral.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.TypeLiteral
的用法示例。
在下文中一共展示了TypeLiteral.setType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGetClassMethodInvocation
import org.eclipse.jdt.core.dom.TypeLiteral; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private MethodInvocation createGetClassMethodInvocation(MethodInvocation invNode, ITypeBinding[] paramTyps, AST ast) {
MethodInvocation result = ast.newMethodInvocation();
result.setName(ast.newSimpleName("getMethod")); //$NON-NLS-1$
StringLiteral methName = ast.newStringLiteral();
methName.setLiteralValue(invNode.getName().getFullyQualifiedName());
result.arguments().add(methName);
if (paramTyps != null && paramTyps.length > 0) {
for (ITypeBinding paramTyp : paramTyps) {
TypeLiteral curTyp = ast.newTypeLiteral();
curTyp.setType(createType(paramTyp, ast));
result.arguments().add(curTyp);
}
}
return result;
}
示例2: makeTypeLiteral
import org.eclipse.jdt.core.dom.TypeLiteral; //导入方法依赖的package包/类
private TypeLiteral makeTypeLiteral(ASTRewrite rewrite, ASTNode node) {
TypeDeclaration tDeclaration = TraversalUtil.findClosestAncestor(node, TypeDeclaration.class);
SimpleName name = tDeclaration.getName();
AST ast = rewrite.getAST();
SimpleType parentType = ast.newSimpleType(ast.newSimpleName(name.getIdentifier()));
TypeLiteral fixedTypeLiteral = ast.newTypeLiteral();
fixedTypeLiteral.setType(parentType);
return fixedTypeLiteral;
}
示例3: makeEnumConstructor
import org.eclipse.jdt.core.dom.TypeLiteral; //导入方法依赖的package包/类
private Expression makeEnumConstructor(EnumCollectionsVisitor visitor, ASTRewrite rewrite) {
AST ast = rewrite.getAST();
TypeLiteral enumDotClass = ast.newTypeLiteral(); // this is the EnumHere.class
enumDotClass.setType(ast.newSimpleType(ast.newName(visitor.enumNameToUse)));
if (visitor.isMap) {
return makeEnumMap(enumDotClass, ast);
}
return makeEnumSet(enumDotClass, ast);
}
示例4: createGetConstructorMethod
import org.eclipse.jdt.core.dom.TypeLiteral; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private MethodInvocation createGetConstructorMethod(ITypeBinding[] paramTyps, AST ast) {
MethodInvocation methGet = ast.newMethodInvocation();
methGet.setName(ast.newSimpleName("getConstructor")); //$NON-NLS-1$
for (ITypeBinding paramTyp : paramTyps) {
TypeLiteral curTyp = ast.newTypeLiteral();
curTyp.setType(createType(paramTyp, ast));
methGet.arguments().add(curTyp);
}
return methGet;
}
示例5: visit
import org.eclipse.jdt.core.dom.TypeLiteral; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean visit(QMethodExec statement) {
try {
if (statement.getObject() != null) {
Block block = blocks.peek();
MethodInvocation methodInvocation = ast.newMethodInvocation();
methodInvocation.setName(ast.newSimpleName(compilationUnit.normalizeTermName(statement.getMethod())));
QNamedNode namedNode = compilationUnit.getNamedNode(statement.getObject(), true);
// display and print
if ((namedNode != null && (namedNode.getParent() instanceof QDisplayTerm || namedNode.getParent() instanceof QPrintTerm))) {
methodInvocation.setExpression(ast.newName(compilationUnit.getQualifiedName((QNamedNode) namedNode.getParent())));
TypeLiteral typeLiteral = ast.newTypeLiteral();
String fileName = compilationUnit.normalizeTypeName(((QNamedNode) namedNode.getParent()).getName());
String formatName = compilationUnit.normalizeTypeName(namedNode.getName());
typeLiteral.setType(ast.newSimpleType(ast.newName(new String[] { fileName, formatName })));
methodInvocation.arguments().add(typeLiteral);
} else {
methodInvocation.setExpression(buildExpression(ast, expressionParser.parseExpression(statement.getObject()), null));
}
if (statement.getParameters() != null) {
for (String parameter : statement.getParameters()) {
QExpression expression = expressionParser.parseExpression(parameter);
Expression jdtExpression = buildExpression(ast, expression, null);
methodInvocation.arguments().add(jdtExpression);
}
}
ExpressionStatement expressionStatement = ast.newExpressionStatement(methodInvocation);
block.statements().add(expressionStatement);
} else {
QProcedureExec procedureExec = QIntegratedLanguageFlowFactory.eINSTANCE.createProcedureExec();
procedureExec.setProcedure(statement.getMethod());
procedureExec.getParameters().addAll(statement.getParameters());
visit(procedureExec);
}
return false;
} catch (Exception e) {
throw new OperatingSystemRuntimeException(e);
}
}