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


Java JvmFormalParameter.setParameterType方法代码示例

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


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

示例1: applyToModel

import org.eclipse.xtext.common.types.JvmFormalParameter; //导入方法依赖的package包/类
@Override
public void applyToModel(IResolvedTypes resolvedTypes) {
	if (!closure.isExplicitSyntax()) {
		List<JvmFormalParameter> parametersToAdd = getParameters();
		InternalEList<JvmFormalParameter> targetList = (InternalEList<JvmFormalParameter>) closure.getImplicitFormalParameters();
		if (!targetList.isEmpty()) {
			// things are already available, do nothing
			return;
		}
		for(int i = 0; i < parametersToAdd.size(); i++) {
			JvmFormalParameter parameter = parametersToAdd.get(i);
			LightweightTypeReference parameterType = resolvedTypes.getActualType(parameter);
			if (parameterType == null) {
				throw new IllegalStateException("Cannot find type for parameter " + parameter.getSimpleName());
			}
			JvmTypeReference typeReference = parameterType.toTypeReference();
			parameter.setParameterType(typeReference);
			targetList.addUnique(parameter);
		}
	}
	((XClosureImplCustom) closure).setLinked(true);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:AbstractClosureTypeHelper.java

示例2: createFormalParameter

import org.eclipse.xtext.common.types.JvmFormalParameter; //导入方法依赖的package包/类
protected JvmFormalParameter createFormalParameter(Type parameterType, String paramName,
		JvmMember container, GenericDeclaration member, Annotation[] annotations) {
	JvmFormalParameter result = TypesFactory.eINSTANCE.createJvmFormalParameter();
	result.setName(paramName);
	if (isLocal(parameterType, member)) {
		result.setParameterType(createLocalTypeReference(parameterType, (JvmTypeParameterDeclarator) container,
				member));
	} else {
		result.setParameterType(createTypeReference(parameterType));
	}
	if (annotations.length != 0) {
		InternalEList<JvmAnnotationReference> annotationsReferences = (InternalEList<JvmAnnotationReference>)result.getAnnotations();
		for (Annotation annotation : annotations) {
			annotationsReferences.addUnique(createAnnotationReference(annotation));
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:ReflectionTypeFactory.java

示例3: toParameter

import org.eclipse.xtext.common.types.JvmFormalParameter; //导入方法依赖的package包/类
/**
 * Creates and returns a formal parameter for the given name and type, which is associated to the given source
 * element.
 * 
 * @return a Java parameter given name, <code>null</code> if sourceElement or name are <code>null</code>.
 */
/* @Nullable */ 
public JvmFormalParameter toParameter(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name, /* @Nullable */ JvmTypeReference typeRef) {
	if(sourceElement == null || name == null)
		return null;
	JvmFormalParameter result = typesFactory.createJvmFormalParameter();
	result.setName(name);
	result.setParameterType(cloneWithProxies(typeRef));
	return associate(sourceElement, result);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:JvmTypesBuilder.java

示例4: completeJvmEnumerationType

import org.eclipse.xtext.common.types.JvmFormalParameter; //导入方法依赖的package包/类
protected void completeJvmEnumerationType(JvmEnumerationType element) {
	if (element.getSuperTypes().isEmpty()) {
		JvmTypeReference objectType = references.getTypeForName(Enum.class, element,
				references.createTypeRef(element));
		if (objectType != null)
			element.getSuperTypes().add(objectType);
	}
	addAnnotations(element);
	EObject primarySourceElement = associations.getPrimarySourceElement(element);
	JvmOperation values = typesFactory.createJvmOperation();
	values.setVisibility(JvmVisibility.PUBLIC);
	values.setStatic(true);
	values.setSimpleName("values");
	values.setReturnType(references.createArrayType(references.createTypeRef(element)));
	typeExtensions.setSynthetic(values, true);
	if (primarySourceElement != null) {
		associator.associate(primarySourceElement, values);
	}
	element.getMembers().add(values);
	
	JvmOperation valueOf = typesFactory.createJvmOperation();
	valueOf.setVisibility(JvmVisibility.PUBLIC);
	valueOf.setStatic(true);
	valueOf.setSimpleName("valueOf");
	valueOf.setReturnType(references.createTypeRef(element));
	JvmFormalParameter param = typesFactory.createJvmFormalParameter();
	param.setName("name");
	param.setParameterType(references.getTypeForName(String.class, element));
	valueOf.getParameters().add(param);
	typeExtensions.setSynthetic(valueOf, true);
	if (primarySourceElement != null) {
		associator.associate(primarySourceElement, valueOf);
	}
	element.getMembers().add(valueOf);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:36,代码来源:JvmModelCompleter.java

示例5: createFormalParameter

import org.eclipse.xtext.common.types.JvmFormalParameter; //导入方法依赖的package包/类
protected JvmFormalParameter createFormalParameter(BinaryTypeSignature parameterType, String paramName,
		JvmMember container, Map<String, JvmTypeParameter> typeParameters) {
	JvmFormalParameter result = TypesFactory.eINSTANCE.createJvmFormalParameter();
	result.setName(paramName);
	result.setParameterType(proxies.createTypeReference(parameterType, typeParameters));
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmExecutableBuilder.java


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