本文整理汇总了Java中org.eclipse.xtext.common.types.JvmGenericType.setPackageName方法的典型用法代码示例。如果您正苦于以下问题:Java JvmGenericType.setPackageName方法的具体用法?Java JvmGenericType.setPackageName怎么用?Java JvmGenericType.setPackageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.common.types.JvmGenericType
的用法示例。
在下文中一共展示了JvmGenericType.setPackageName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJvmTypeSimple_Issue145
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeSimple_Issue145() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("SimpleName");
expected.setPackageName("package.name");
resource.getContents().add(expected);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName");
assertEquals(expected, actual);
resource.getContents().remove(expected);
((InternalEObject)expected).eSetProxyURI(EcoreUtil.getURI(expected));
JvmGenericType expected2 = TypesFactory.eINSTANCE.createJvmGenericType();
expected2.setSimpleName("SimpleName");
expected2.setPackageName("package.name");
resource.getContents().add(expected2);
JvmType actual2 = getTypeProvider().findTypeByName("package.name.SimpleName");
assertEquals(expected2, actual2);
}
示例2: createJvmGenericType
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
protected JvmGenericType createJvmGenericType(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name) {
if (sourceElement == null || name == null)
return null;
Pair<String, String> fullName = splitQualifiedName(name);
final JvmGenericType result = typesFactory.createJvmGenericType();
result.setSimpleName(fullName.getSecond());
if (fullName.getFirst() != null)
result.setPackageName(fullName.getFirst());
result.setVisibility(JvmVisibility.PUBLIC);
return result;
}
示例3: testGetElementByInstance_01
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test public void testGetElementByInstance_01() {
JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor();
JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType();
type.setPackageName("java.lang");
type.setSimpleName("Object");
constructor.setSimpleName("Object");
type.getMembers().add(constructor);
IEObjectDescription element = getConstructorScope().getSingleElement(constructor);
assertNotNull(element);
assertEquals(new IQualifiedNameConverter.DefaultImpl().toQualifiedName("java.lang.Object"), element.getName());
assertEquals(new IQualifiedNameConverter.DefaultImpl().toQualifiedName("java.lang.Object"), element.getQualifiedName());
}
示例4: testJvmTypeSimple
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeSimple() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("SimpleName");
expected.setPackageName("package.name");
resource.getContents().add(expected);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName");
assertEquals(expected, actual);
}
示例5: testJvmTypeNestedClass
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeNestedClass() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType container = TypesFactory.eINSTANCE.createJvmGenericType();
container.setSimpleName("SimpleName");
container.setPackageName("package.name");
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("Child");
container.getMembers().add(expected);
resource.getContents().add(container);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName$Child");
assertEquals(expected, actual);
}
示例6: testJvmTypeNestedClassWithDot_01
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeNestedClassWithDot_01() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType container = TypesFactory.eINSTANCE.createJvmGenericType();
container.setSimpleName("SimpleName");
container.setPackageName("package.name");
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("Child");
container.getMembers().add(expected);
resource.getContents().add(container);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName.Child", false);
assertEquals(expected, actual);
}
示例7: testJvmTypeNestedClassWithDot_02
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeNestedClassWithDot_02() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType container = TypesFactory.eINSTANCE.createJvmGenericType();
container.setSimpleName("SimpleName");
container.setPackageName("package.name");
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("Child");
container.getMembers().add(expected);
resource.getContents().add(container);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName.Child", true);
assertNull(actual);
}
示例8: testJvmTypeArray
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Test
public void testJvmTypeArray() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
expected.setSimpleName("SimpleName");
expected.setPackageName("package.name");
resource.getContents().add(expected);
JvmType actual = getTypeProvider().findTypeByName("package.name.SimpleName[]");
assertTrue(actual instanceof JvmArrayType);
assertEquals(expected, ((JvmArrayType) actual).getComponentType());
}