本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例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)));
}