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


Java ParameterizedType类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedType类的具体用法?Java ParameterizedType怎么用?Java ParameterizedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ParameterizedType类属于org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types包,在下文中一共展示了ParameterizedType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeFixedElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
public void makeFixedElementVariables(ConstraintVariable2 expressionCv, TType type) {
  if (isAGenericType(type)) {
    GenericType genericType = (GenericType) type.getTypeDeclaration();
    TType[] typeParameters = genericType.getTypeParameters();
    TType[] typeArguments = null;
    if (type.isParameterizedType()) typeArguments = ((ParameterizedType) type).getTypeArguments();

    for (int i = 0; i < typeParameters.length; i++) {
      TypeVariable typeVariable = (TypeVariable) typeParameters[i];
      CollectionElementVariable2 elementCv = makeElementVariable(expressionCv, typeVariable, i);
      TType referenceTypeArgument;
      if (typeArguments == null) { // raw type
        continue; // do not consider
      } else {
        referenceTypeArgument = typeArguments[i];
      }
      createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
      //				if (typeVariable.getBounds().length != 0) {
      //					//TODO: create subtype constraints for bounds
      //				}
    }
  }
  makeFixedElementVariablesFromSupertypes(expressionCv, type.getTypeDeclaration());
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:InferTypeArgumentsTCModel.java

示例2: makeFixedElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
public void makeFixedElementVariables(ConstraintVariable2 expressionCv, TType type) {
		if (isAGenericType(type)) {
			GenericType genericType= (GenericType) type.getTypeDeclaration();
			TType[] typeParameters= genericType.getTypeParameters();
			TType[] typeArguments= null;
			if (type.isParameterizedType())
				typeArguments= ((ParameterizedType) type).getTypeArguments();

			for (int i= 0; i < typeParameters.length; i++) {
				TypeVariable typeVariable= (TypeVariable) typeParameters[i];
				CollectionElementVariable2 elementCv= makeElementVariable(expressionCv, typeVariable, i);
				TType referenceTypeArgument;
				if (typeArguments == null) { // raw type
					continue; // do not consider
				} else {
					referenceTypeArgument= typeArguments[i];
				}
				createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
//				if (typeVariable.getBounds().length != 0) {
//					//TODO: create subtype constraints for bounds
//				}
			}
		}
		makeFixedElementVariablesFromSupertypes(expressionCv, type.getTypeDeclaration());
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:InferTypeArgumentsTCModel.java

示例3: makeFixedSupertypeElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
private void makeFixedSupertypeElementVariables(ConstraintVariable2 expressionCv, TType supertype) {
	if (supertype.isParameterizedType() || supertype.isRawType()) {
		TType[] typeArguments= null;
		if (supertype.isParameterizedType())
			typeArguments= ((ParameterizedType) supertype).getTypeArguments();

		TypeVariable[] typeParameters= ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
		for (int i= 0; i < typeParameters.length; i++) {
			TypeVariable typeParameter= typeParameters[i];
			TType referenceTypeArgument;
			if (typeArguments == null) { // raw type
				continue; // do not consider
			} else {
				referenceTypeArgument= typeArguments[i];
			}
			if (referenceTypeArgument.isTypeVariable()) {
				CollectionElementVariable2 referenceTypeArgumentCv= getElementVariable(expressionCv, (TypeVariable) referenceTypeArgument);
				setElementVariable(expressionCv, referenceTypeArgumentCv, typeParameter);
			} else {
				CollectionElementVariable2 elementCv= makeElementVariable(expressionCv, typeParameter, CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
				createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
			}
		}
	}
	makeFixedElementVariablesFromSupertypes(expressionCv, supertype);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:InferTypeArgumentsTCModel.java

示例4: makeSupertypeElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
private void makeSupertypeElementVariables(ConstraintVariable2 expressionCv, TType supertype) {
  if (supertype.isParameterizedType() || supertype.isRawType()) {
    TType[] typeArguments = null;
    if (supertype.isParameterizedType()) {
      typeArguments = ((ParameterizedType) supertype).getTypeArguments();
    }
    TypeVariable[] typeParameters =
        ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
    for (int i = 0; i < typeParameters.length; i++) {
      TypeVariable typeParameter = typeParameters[i];
      TType referenceTypeArgument;
      if (typeArguments == null) { // raw type
        referenceTypeArgument = typeParameter.getErasure();
      } else {
        referenceTypeArgument = typeArguments[i];
      }
      if (referenceTypeArgument.isTypeVariable()) {
        CollectionElementVariable2 referenceTypeArgumentCv =
            getElementVariable(expressionCv, (TypeVariable) referenceTypeArgument);
        if (referenceTypeArgumentCv != null) {
          setElementVariable(expressionCv, referenceTypeArgumentCv, typeParameter);
          continue;
        }
      }
      makeElementVariable(
          expressionCv,
          typeParameter,
          CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
    }
  }
  makeElementVariablesFromSupertypes(expressionCv, supertype);
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:InferTypeArgumentsTCModel.java

示例5: makeFixedSupertypeElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
private void makeFixedSupertypeElementVariables(
    ConstraintVariable2 expressionCv, TType supertype) {
  if (supertype.isParameterizedType() || supertype.isRawType()) {
    TType[] typeArguments = null;
    if (supertype.isParameterizedType())
      typeArguments = ((ParameterizedType) supertype).getTypeArguments();

    TypeVariable[] typeParameters =
        ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
    for (int i = 0; i < typeParameters.length; i++) {
      TypeVariable typeParameter = typeParameters[i];
      TType referenceTypeArgument;
      if (typeArguments == null) { // raw type
        continue; // do not consider
      } else {
        referenceTypeArgument = typeArguments[i];
      }
      if (referenceTypeArgument.isTypeVariable()) {
        CollectionElementVariable2 referenceTypeArgumentCv =
            getElementVariable(expressionCv, (TypeVariable) referenceTypeArgument);
        setElementVariable(expressionCv, referenceTypeArgumentCv, typeParameter);
      } else {
        CollectionElementVariable2 elementCv =
            makeElementVariable(
                expressionCv,
                typeParameter,
                CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
        createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
      }
    }
  }
  makeFixedElementVariablesFromSupertypes(expressionCv, supertype);
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:InferTypeArgumentsTCModel.java

示例6: makeSupertypeElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ParameterizedType; //导入依赖的package包/类
private void makeSupertypeElementVariables(ConstraintVariable2 expressionCv, TType supertype) {
	if (supertype.isParameterizedType() || supertype.isRawType()) {
		TType[] typeArguments= null;
		if (supertype.isParameterizedType()) {
			typeArguments= ((ParameterizedType) supertype).getTypeArguments();
		}
		TypeVariable[] typeParameters= ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
		for (int i= 0; i < typeParameters.length; i++) {
			TypeVariable typeParameter= typeParameters[i];
			TType referenceTypeArgument;
			if (typeArguments == null) { // raw type
				referenceTypeArgument= typeParameter.getErasure();
			} else {
				referenceTypeArgument= typeArguments[i];
			}
			if (referenceTypeArgument.isTypeVariable()) {
				CollectionElementVariable2 referenceTypeArgumentCv= getElementVariable(expressionCv, (TypeVariable) referenceTypeArgument);
				if (referenceTypeArgumentCv != null) {
					setElementVariable(expressionCv, referenceTypeArgumentCv, typeParameter);
					continue;
				}
			}
			makeElementVariable(expressionCv, typeParameter, CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
		}
	}
	makeElementVariablesFromSupertypes(expressionCv, supertype);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:InferTypeArgumentsTCModel.java


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