use of org.eclipse.xtext.naming.QualifiedName in project xtext-eclipse by eclipse.
the class AbstractConstructorScopeTest method testGetElementsByName_03.
@Test
public void testGetElementsByName_03() {
List<String> segments = Strings.split("org.eclipse.xtext.common.types.testSetups.NestedParameterizedTypes.WrappedCollection.WrappedIterator", '.');
QualifiedName qualifiedName = QualifiedName.create(segments);
Iterable<IEObjectDescription> descriptions = getConstructorScope().getElements(qualifiedName);
for (IEObjectDescription description : descriptions) {
assertEquals(qualifiedName, description.getName());
}
assertEquals(3, Iterables.size(descriptions));
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-eclipse by eclipse.
the class AbstractConstructorScopeTest method testGetElementsByInstance_04.
@Test
public void testGetElementsByInstance_04() {
QualifiedName qualifiedName = QualifiedName.create("java", "util", "Hashtable", "Entry");
IEObjectDescription hashMapEntry = getConstructorScope().getSingleElement(qualifiedName);
JvmConstructor constructor = (JvmConstructor) hashMapEntry.getEObjectOrProxy();
Iterable<IEObjectDescription> descriptions = getConstructorScope().getElements(constructor);
List<IEObjectDescription> list = Lists.newArrayList(descriptions);
assertEquals(2, list.size());
assertEquals(qualifiedName, list.get(0).getName());
QualifiedName qualifiedNameWithDollar = QualifiedName.create("java", "util", "Hashtable$Entry");
assertEquals(qualifiedNameWithDollar, list.get(1).getName());
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-eclipse by eclipse.
the class AbstractConstructorScopeTest method testGetElementByInstance_04.
@Test
public void testGetElementByInstance_04() {
QualifiedName qualifiedName = QualifiedName.create("java", "util", "Hashtable", "Entry");
IEObjectDescription hashMapEntry = getConstructorScope().getSingleElement(qualifiedName);
JvmConstructor constructor = (JvmConstructor) hashMapEntry.getEObjectOrProxy();
IEObjectDescription element = getConstructorScope().getSingleElement(constructor);
assertNotNull(element);
assertEquals(qualifiedName, element.getName());
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-eclipse by eclipse.
the class EObjectDescriptionBasedStubGeneratorTest method testNested.
@Test
public void testNested() {
final EObjectDescription _top = new EObjectDescription(QualifiedName.create("foo", "Bar"), TypesFactory.eINSTANCE.createJvmGenericType(), Collections.<String, String>emptyMap());
final EObjectDescription _nested0 = new EObjectDescription(QualifiedName.create("foo", "Bar$Baz0"), TypesFactory.eINSTANCE.createJvmGenericType(), Collections.singletonMap(JvmTypesResourceDescriptionStrategy.IS_NESTED_TYPE, Boolean.TRUE.toString()));
final EObjectDescription _nested1 = new EObjectDescription(QualifiedName.create("foo", "Bar$Baz1"), TypesFactory.eINSTANCE.createJvmGenericType(), Collections.singletonMap(JvmTypesResourceDescriptionStrategy.IS_NESTED_TYPE, Boolean.TRUE.toString()));
final EObjectDescription _nested10 = new EObjectDescription(QualifiedName.create("foo", "Bar$Baz1$FooBar0"), TypesFactory.eINSTANCE.createJvmGenericType(), Collections.singletonMap(JvmTypesResourceDescriptionStrategy.IS_NESTED_TYPE, Boolean.TRUE.toString()));
final EObjectDescription _nested11 = new EObjectDescription(QualifiedName.create("foo", "Bar$Baz1$FooBar0"), TypesFactory.eINSTANCE.createJvmGenericType(), Collections.singletonMap(JvmTypesResourceDescriptionStrategy.IS_NESTED_TYPE, Boolean.TRUE.toString()));
IResourceDescription resourceDescription = new AbstractResourceDescription() {
@Override
public URI getURI() {
return null;
}
@Override
public Iterable<IReferenceDescription> getReferenceDescriptions() {
return Collections.emptyList();
}
@Override
public Iterable<QualifiedName> getImportedNames() {
return Collections.emptyList();
}
@Override
protected List<IEObjectDescription> computeExportedObjects() {
return Arrays.asList(new IEObjectDescription[] { _top, _nested0, _nested1, _nested10, _nested11 });
}
};
assertEquals("package foo;\n" + "public class Bar{\n" + "public static class Baz0{\n" + "}\n" + "public static class Baz1{\n" + "public static class FooBar0{\n" + "}\n" + "public static class FooBar0{\n" + "}\n" + "}\n" + "}", gen.getJavaStubSource(_top, resourceDescription));
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-eclipse by eclipse.
the class BuilderStateFactoryImpl method convertQualifiedNameToString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertQualifiedNameToString(EDataType eDataType, Object instanceValue) {
QualifiedName qn = (QualifiedName) instanceValue;
String[] array = qn.getSegments().toArray(new String[qn.getSegmentCount()]);
String packed = Strings.pack(array);
if (packed == null)
return "";
return packed;
}
Aggregations