• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JvmWildcardTypeReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_twoListWildcardsNoResult_03

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_twoListWildcardsNoResult_03() {
	JvmOperation twoListWildcardsNoResult = getMethodFromParameterizedMethods(
			"twoListWildcardsNoResult(java.util.List,java.util.List)");
	JvmFormalParameter firstParam = twoListWildcardsNoResult.getParameters().get(0);
	JvmTypeReference paramType = firstParam.getParameterType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) paramType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	assertTrue(typeParameter instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcard = (JvmWildcardTypeReference) typeParameter;
	assertEquals(1, wildcard.getConstraints().size());
	assertTrue(wildcard.getConstraints().get(0) instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) wildcard.getConstraints().get(0);
	assertNotNull(upperBound.getTypeReference());
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertFalse(upperBoundType.eIsProxy());
	assertEquals("java.lang.Object", upperBoundType.getIdentifier());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractTypeProviderTest.java


示例2: test_twoListWildcardsListResult_03

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_twoListWildcardsListResult_03() {
	JvmOperation twoListWildcardsListResult = getMethodFromParameterizedMethods(
			"twoListWildcardsListResult(java.util.List,java.util.List)");
	JvmTypeReference returnType = twoListWildcardsListResult.getReturnType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) returnType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	assertTrue(typeParameter instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcard = (JvmWildcardTypeReference) typeParameter;
	assertEquals(1, wildcard.getConstraints().size());
	assertTrue(wildcard.getConstraints().get(0) instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) wildcard.getConstraints().get(0);
	assertNotNull(upperBound.getTypeReference());
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertFalse(upperBoundType.eIsProxy());
	assertEquals("java.lang.Object", upperBoundType.getIdentifier());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractTypeProviderTest.java


示例3: test_ParameterizedTypes_02

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_02() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodS = getMethodFromType(type, ParameterizedTypes.class, "methodS(S)");
	JvmTypeReference listS = methodS.getReturnType();
	assertFalse(listS.toString(), listS.eIsProxy());
	assertEquals("java.util.List<? extends S>", listS.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listS;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends S", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmTypeParameter s = type.getTypeParameters().get(0);
	assertSame(s, upperBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractTypeProviderTest.java


示例4: test_ParameterizedTypes_03

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_03() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodT = getMethodFromType(type, ParameterizedTypes.class, "methodT(T)");
	JvmTypeReference listS = methodT.getReturnType();
	assertFalse(listS.toString(), listS.eIsProxy());
	assertEquals("java.util.List<? extends java.lang.Object & super T>", listS.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listS;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends java.lang.Object & super T", wildcardTypeArgument.getIdentifier());
	assertEquals(2, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound uperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	assertEquals("java.lang.Object", uperBound.getTypeReference().getIdentifier());
	JvmLowerBound lowerBound = (JvmLowerBound) wildcardTypeArgument.getConstraints().get(1);
	JvmTypeParameter t = type.getTypeParameters().get(1);
	assertSame(t, lowerBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:AbstractTypeProviderTest.java


示例5: test_ParameterizedTypes_05

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodZ = getMethodFromType(type, ParameterizedTypes.class, "methodZ(java.util.List)");
	assertEquals(1, methodZ.getParameters().size());
	assertEquals(1, methodZ.getTypeParameters().size());
	assertEquals("Z", methodZ.getTypeParameters().get(0).getIdentifier());
	JvmTypeReference listZ = methodZ.getReturnType();
	assertFalse(listZ.toString(), listZ.getType().eIsProxy());
	assertEquals("java.util.List<? extends java.lang.Object & super Z>", listZ.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listZ;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends java.lang.Object & super Z", wildcardTypeArgument.getIdentifier());
	assertEquals(2, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	assertEquals("java.lang.Object", upperBound.getTypeReference().getIdentifier());
	JvmLowerBound lowerBound = (JvmLowerBound) wildcardTypeArgument.getConstraints().get(1);
	assertEquals("Z", lowerBound.getTypeReference().getIdentifier());
	JvmTypeParameter z = methodZ.getTypeParameters().get(0);
	assertSame(z, lowerBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:AbstractTypeProviderTest.java


示例6: test_ParameterizedTypes_06

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_06() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodMap = getMethodFromType(type, ParameterizedTypes.class, "methodMap(java.util.Map)");
	assertEquals(1, methodMap.getParameters().size());
	assertEquals(1, methodMap.getTypeParameters().size());
	assertEquals("Z", methodMap.getTypeParameters().get(0).getIdentifier());
	JvmType z = methodMap.getReturnType().getType();
	assertSame(methodMap.getTypeParameters().get(0), z);
	JvmTypeReference mapType = methodMap.getParameters().get(0).getParameterType();
	assertEquals("java.util.Map<? extends java.lang.Object & super Z, ? extends S>", mapType.getIdentifier());
	JvmParameterizedTypeReference parameterizedMapType = (JvmParameterizedTypeReference) mapType;
	assertEquals(2, parameterizedMapType.getArguments().size());
	JvmWildcardTypeReference extendsS = (JvmWildcardTypeReference) parameterizedMapType.getArguments().get(1);
	assertEquals(1, extendsS.getConstraints().size());
	JvmType s = type.getTypeParameters().get(0);
	assertSame(s, extendsS.getConstraints().get(0).getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractTypeProviderTest.java


示例7: test_ParameterizedTypes_Inner_05

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_Inner_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_01()");
	JvmTypeReference listT = methodV.getReturnType();
	assertEquals("java.util.List<? extends V>[]", listT.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listT)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, upperBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractTypeProviderTest.java


示例8: test_ParameterizedTypes_Inner_06

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_Inner_06() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_02()");
	JvmTypeReference listV = methodV.getReturnType();
	assertEquals("java.util.List<? extends V[]>", listV.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listV;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V[]", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertTrue(upperBoundType instanceof JvmArrayType);
	assertTrue(((JvmArrayType) upperBoundType).getComponentType() instanceof JvmTypeParameter);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, ((JvmArrayType) upperBoundType).getComponentType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:AbstractTypeProviderTest.java


示例9: checkNotMultipleBounds

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Check
public void checkNotMultipleBounds(JvmWildcardTypeReference typeRef) {
	List<JvmTypeConstraint> constraints = typeRef.getConstraints();
	if (constraints.size() >= 2) {
		int upperBounds = 0;
		int lowerBounds = 0;
		for(int i = 0; i < constraints.size(); i++) {
			JvmTypeConstraint constraint = constraints.get(i);
			if (constraint.eClass() == TypesPackage.Literals.JVM_UPPER_BOUND) {
				upperBounds++;
				if (upperBounds > 1) {
					error("Invalid type constraint. Cannot use multiple upper bounds in wildcards.", 
							typeRef, TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS, i, IssueCodes.INVALID_WILDCARD_CONSTRAINTS);
					return;
				}
			} else {
				lowerBounds++;
				if (lowerBounds > 1) {
					error("Invalid type constraint. Cannot use multiple lower bounds in wildcards.", 
							typeRef, TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS, i, IssueCodes.INVALID_WILDCARD_CONSTRAINTS);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:JvmTypeReferencesValidator.java


示例10: computeFor

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
static String computeFor(JvmWildcardTypeReference typeReference, char innerClassDelimiter, NameType nameType) {
	if (typeReference.eIsSet(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS)) {
		if (typeReference.getConstraints().size() == 1) {
			JvmTypeConstraint onlyConstraint = typeReference.getConstraints().get(0);
			if (nameType != NameType.ID && nameType != NameType.TO_STRING) {
				JvmTypeReference reference = onlyConstraint.getTypeReference();
				if (reference == null || (onlyConstraint instanceof JvmUpperBound && 
						Object.class.getCanonicalName().equals(onlyConstraint.getTypeReference().getIdentifier()))) {
					return "?";
				}
			} else if (nameType == NameType.ID && onlyConstraint.getTypeReference() == null) {
				return "?";
			}
		}
		StringBuilder mutableResult = new StringBuilder(64);
		mutableResult.append("? ");
		appendConstraintsName(mutableResult, typeReference.getConstraints(), innerClassDelimiter, nameType);
		return mutableResult.toString();
	}
	return "?";
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:NameConcatHelper.java


示例11: test_ParameterizedTypes_V_01

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void test_ParameterizedTypes_V_01() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmTypeParameter typeParameterV = type.getTypeParameters().get(3);
	assertEquals("V", typeParameterV.getIdentifier());
	assertSame(type, typeParameterV.getDeclarator());
	assertEquals(1, typeParameterV.getConstraints().size());
	JvmTypeConstraint typeConstraint = typeParameterV.getConstraints().get(0);
	assertTrue(typeConstraint instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) typeConstraint;
	assertNotNull(upperBound.getTypeReference());
	assertFalse(upperBound.getTypeReference().toString(), upperBound.getTypeReference().eIsProxy());
	assertEquals("java.util.List<java.util.List<? extends V>>", upperBound.getTypeReference().getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) upperBound.getTypeReference();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertEquals("java.util.List<? extends V>", typeArgument.getIdentifier());
	JvmParameterizedTypeReference nestedListType = (JvmParameterizedTypeReference) typeArgument;
	assertEquals(1, nestedListType.getArguments().size());
	JvmTypeReference nestedArgument = nestedListType.getArguments().get(0);
	assertTrue(nestedArgument instanceof JvmWildcardTypeReference);
	assertEquals(1, ((JvmWildcardTypeReference) nestedArgument).getConstraints().size());
	JvmUpperBound nestedUpperBound = (JvmUpperBound) ((JvmWildcardTypeReference) nestedArgument).getConstraints()
			.get(0);
	assertSame(typeParameterV, nestedUpperBound.getTypeReference().getType());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:28,代码来源:AbstractTypeProviderTest.java


示例12: acceptType

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
protected void acceptType(JvmTypeReference ref) {
	if (ref instanceof XFunctionTypeRef 
	 || ref instanceof JvmWildcardTypeReference
	 || ref instanceof JvmGenericArrayTypeReference
	 || (ref.eContainer() instanceof XFunctionTypeRef 
			 && ref.eContainmentFeature() == JVM_SPECIALIZED_TYPE_REFERENCE__EQUIVALENT)
	 || NodeModelUtils.findActualNodeFor(ref) == null) 
		return;
	else 
		acceptPreferredType(ref);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:TypeUsageCollector.java


示例13: _format

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
protected void _format(final JvmWildcardTypeReference ref, @Extension final IFormattableDocument document) {
  boolean _isEmpty = ref.getConstraints().isEmpty();
  boolean _not = (!_isEmpty);
  if (_not) {
    final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
      it.oneSpace();
    };
    document.append(this.textRegionExtensions.regionFor(ref).keyword("?"), _function);
  }
  EList<JvmTypeConstraint> _constraints = ref.getConstraints();
  for (final JvmTypeConstraint c : _constraints) {
    document.<JvmTypeConstraint>format(c);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:XtypeFormatter.java


示例14: format

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
public void format(final Object ref, final IFormattableDocument document) {
  if (ref instanceof JvmTypeParameter) {
    _format((JvmTypeParameter)ref, document);
    return;
  } else if (ref instanceof XtextResource) {
    _format((XtextResource)ref, document);
    return;
  } else if (ref instanceof XFunctionTypeRef) {
    _format((XFunctionTypeRef)ref, document);
    return;
  } else if (ref instanceof JvmParameterizedTypeReference) {
    _format((JvmParameterizedTypeReference)ref, document);
    return;
  } else if (ref instanceof JvmWildcardTypeReference) {
    _format((JvmWildcardTypeReference)ref, document);
    return;
  } else if (ref instanceof XImportDeclaration) {
    _format((XImportDeclaration)ref, document);
    return;
  } else if (ref instanceof XImportSection) {
    _format((XImportSection)ref, document);
    return;
  } else if (ref instanceof EObject) {
    _format((EObject)ref, document);
    return;
  } else if (ref == null) {
    _format((Void)null, document);
    return;
  } else if (ref != null) {
    _format(ref, document);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(ref, document).toString());
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:37,代码来源:XtypeFormatter.java


示例15: doVisitWildcardTypeReference

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Override
public Boolean doVisitWildcardTypeReference(final JvmWildcardTypeReference it) {
  final Function1<JvmTypeConstraint, Boolean> _function = (JvmTypeConstraint it_1) -> {
    return this.visit(it_1.getTypeReference());
  };
  return Boolean.valueOf(IterableExtensions.<JvmTypeConstraint>exists(it.getConstraints(), _function));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:BrokenTypeRefDetector.java


示例16: _format

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
protected void _format(final JvmWildcardTypeReference ref, final FormattableDocument document) {
  boolean _isEmpty = ref.getConstraints().isEmpty();
  boolean _not = (!_isEmpty);
  if (_not) {
    final Procedure1<FormattingDataInit> _function = (FormattingDataInit it) -> {
      it.oneSpace();
    };
    Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _append = this._formattingDataFactory.append(this._nodeModelAccess.nodeForKeyword(ref, "?"), _function);
    document.operator_add(_append);
  }
  EList<JvmTypeConstraint> _constraints = ref.getConstraints();
  for (final JvmTypeConstraint c : _constraints) {
    this.format(c, document);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:XbaseFormatter2.java


示例17: wildCardExtends

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
public JvmParameterizedTypeReferenceConstructor wildCardExtends(String qualifiedName) {
	JvmWildcardTypeReference argument = typesFactory.createJvmWildcardTypeReference();
	JvmUpperBound upperBound = typesFactory.createJvmUpperBound();
	argument.getConstraints().add(upperBound);
	JvmParameterizedTypeReferenceConstructor constructor = new JvmParameterizedTypeReferenceConstructor(qualifiedName, typesFactory, typesProvider, this);
	upperBound.setTypeReference(constructor.getReference());
	reference.getArguments().add(argument);
	return constructor;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:JvmTypeReferences.java


示例18: wildCardSuper

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
public JvmParameterizedTypeReferenceConstructor wildCardSuper(String qualifiedName) {
	JvmWildcardTypeReference argument = typesFactory.createJvmWildcardTypeReference();
	JvmLowerBound upperBound = typesFactory.createJvmLowerBound();
	argument.getConstraints().add(upperBound);
	JvmParameterizedTypeReferenceConstructor constructor = new JvmParameterizedTypeReferenceConstructor(qualifiedName, typesFactory, typesProvider, this);
	upperBound.setTypeReference(constructor.getReference());
	reference.getArguments().add(argument);
	return constructor;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:JvmTypeReferences.java


示例19: testWildcard_02

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void testWildcard_02() {
  JvmTypeReference _wildcardExtends = this.typeReferenceBuilder.wildcardExtends(this.typeReferenceBuilder.typeRef(CharSequence.class));
  final EList<JvmTypeConstraint> constraints = ((JvmWildcardTypeReference) _wildcardExtends).getConstraints();
  Assert.assertEquals(1, constraints.size());
  Assert.assertEquals("java.lang.CharSequence", IterableExtensions.<JvmUpperBound>head(Iterables.<JvmUpperBound>filter(constraints, JvmUpperBound.class)).getTypeReference().getIdentifier());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmTypeReferenceBuilderTest.java


示例20: testWildcard_03

import org.eclipse.xtext.common.types.JvmWildcardTypeReference; //导入依赖的package包/类
@Test
public void testWildcard_03() {
  JvmTypeReference _wildcardSuper = this.typeReferenceBuilder.wildcardSuper(this.typeReferenceBuilder.typeRef(CharSequence.class));
  final EList<JvmTypeConstraint> constraints = ((JvmWildcardTypeReference) _wildcardSuper).getConstraints();
  Assert.assertEquals(2, constraints.size());
  Assert.assertEquals("java.lang.CharSequence", IterableExtensions.<JvmLowerBound>head(Iterables.<JvmLowerBound>filter(constraints, JvmLowerBound.class)).getTypeReference().getIdentifier());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmTypeReferenceBuilderTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DatabaseDialects类代码示例发布时间:2022-05-22
下一篇:
Java Comment类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap