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


Java TypeLiteral.setType方法代码示例

本文整理汇总了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;
}
 
开发者ID:jwloka,项目名称:reflectify,代码行数:17,代码来源:MethodInvocationProposalCreator.java

示例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;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:10,代码来源:LoggerOdditiesResolution.java

示例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);
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:11,代码来源:UseEnumCollectionsResolution.java

示例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;
}
 
开发者ID:jwloka,项目名称:reflectify,代码行数:12,代码来源:ClassInstanceCreationProposalCreator.java

示例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);
	}
}
 
开发者ID:asupdev,项目名称:asup,代码行数:56,代码来源:JDTStatementWriter.java


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