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


Java JvmGenericType.getSuperTypes方法代码示例

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


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

示例1: testInterfaceCreation

import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testInterfaceCreation() {
  try {
    final XExpression e = this.expression("\'foo\'");
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
      EList<JvmTypeReference> _superTypes = it.getSuperTypes();
      JvmTypeReference _typeRef = this._jvmTypeReferenceBuilder.typeRef(Iterable.class);
      this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
    };
    final JvmGenericType anno = this._jvmTypesBuilder.toInterface(e, "foo.bar.MyAnnotation", _function);
    Assert.assertTrue(anno.isInterface());
    Assert.assertEquals("foo.bar", anno.getPackageName());
    Assert.assertEquals("MyAnnotation", anno.getSimpleName());
    Assert.assertEquals(1, anno.getSuperTypes().size());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:JvmTypesBuilderTest.java

示例2: testImplements

import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testImplements() {
  try {
    final XExpression expression = this.expression("null", false);
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
      it.setAbstract(true);
      EList<JvmTypeReference> _superTypes = it.getSuperTypes();
      JvmTypeReference _typeRef = this.typeRef(expression, Iterable.class, String.class);
      this.builder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
    };
    final JvmGenericType clazz = this.builder.toClass(expression, "my.test.Foo", _function);
    final Class<?> compiled = this.compile(expression.eResource(), clazz);
    Assert.assertTrue(Iterable.class.isAssignableFrom(compiled));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:JvmModelGeneratorTest.java

示例3: testExtends

import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testExtends() {
  try {
    final XExpression expression = this.expression("null", false);
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
      it.setAbstract(true);
      EList<JvmTypeReference> _superTypes = it.getSuperTypes();
      JvmTypeReference _typeRef = this.typeRef(expression, AbstractList.class, String.class);
      this.builder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
    };
    final JvmGenericType clazz = this.builder.toClass(expression, "my.test.Foo", _function);
    final Class<?> compiled = this.compile(expression.eResource(), clazz);
    Assert.assertTrue(Iterable.class.isAssignableFrom(compiled));
    Assert.assertTrue(AbstractList.class.isAssignableFrom(compiled));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:JvmModelGeneratorTest.java

示例4: testRawIterable_01

import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testRawIterable_01() {
	String typeName = RawIterable.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	List<JvmTypeReference> superTypes = type.getSuperTypes();
	JvmParameterizedTypeReference iterableSuperType = (JvmParameterizedTypeReference) superTypes.get(1);
	assertEquals("java.lang.Iterable", iterableSuperType.getIdentifier());
	assertTrue(iterableSuperType.getArguments().isEmpty());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:AbstractTypeProviderTest.java

示例5: testRecursiveInheritance

import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testRecursiveInheritance() {
  final EObject eObject = EcoreFactory.eINSTANCE.createEObject();
  final JvmGenericType bar = this._jvmTypesBuilder.toClass(eObject, "Bar");
  final JvmGenericType foo = this._jvmTypesBuilder.toClass(eObject, "Foo");
  EList<JvmTypeReference> _superTypes = bar.getSuperTypes();
  JvmTypeReference _newTypeRef = this._jvmTypesBuilder.newTypeRef(foo);
  this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _newTypeRef);
  EList<JvmTypeReference> _superTypes_1 = foo.getSuperTypes();
  JvmTypeReference _newTypeRef_1 = this._jvmTypesBuilder.newTypeRef(bar);
  this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes_1, _newTypeRef_1);
  Assert.assertNotNull(this._jvmDeclaredTypeSignatureHashProvider.getHash(foo));
  Assert.assertFalse(Strings.equal(this._jvmDeclaredTypeSignatureHashProvider.getHash(foo), this._jvmDeclaredTypeSignatureHashProvider.getHash(bar)));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:TypeSignatureHashTest.java


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