Java Code Examples for org.eclipse.xtext.common.types.TypesFactory

The following examples show how to use org.eclipse.xtext.common.types.TypesFactory. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
 * that can be created under this object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
	super.collectNewChildDescriptors(newChildDescriptors, object);

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS,
			 TypesFactory.eINSTANCE.createJvmUpperBound()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS,
			 TypesFactory.eINSTANCE.createJvmLowerBound()));
}
 
Example 2
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 2.4
 */
protected JvmOperation createOperation(StringBuilder qualifiedName, String handleIdentifier, String[] path, IMethodBinding method) {
	JvmOperation result = TypesFactory.eINSTANCE.createJvmOperation();
	enhanceGenericDeclaration(result, method.getTypeParameters());
	enhanceExecutable(qualifiedName, handleIdentifier, path, result, method);
	int modifiers = method.getModifiers();
	result.setAbstract(Modifier.isAbstract(modifiers));
	result.setFinal(Modifier.isFinal(modifiers));
	result.setStatic(Modifier.isStatic(modifiers));
	result.setStrictFloatingPoint(Modifier.isStrictfp(modifiers));
	result.setSynchronized(Modifier.isSynchronized(modifiers));
	result.setNative(Modifier.isNative(modifiers));
	result.setReturnType(createTypeReference(method.getReturnType()));
	createAnnotationValues(method, result);
	return result;
}
 
Example 3
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createShortAnnotationValue(Object value) {
	JvmShortAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmShortAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof Short) {
					values.addUnique(element);
				} else if (element != null) {
					values.addUnique(((Number)element).shortValue());
				}
			}
		} else if (value instanceof Short) {
			values.addUnique(value);
		} else if (value instanceof Number) {
			values.addUnique(((Number)value).shortValue());
		}
	}
	return annotationValue;
}
 
Example 4
/**
 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
 * that can be created under this object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
	super.collectNewChildDescriptors(newChildDescriptors, object);

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS,
			 TypesFactory.eINSTANCE.createJvmUpperBound()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_CONSTRAINT_OWNER__CONSTRAINTS,
			 TypesFactory.eINSTANCE.createJvmLowerBound()));
}
 
Example 5
Source Project: xtext-extras   Source File: JvmModelCompleter.java    License: Eclipse Public License 2.0 6 votes vote down vote up
protected void completeJvmGenericType(JvmGenericType element) {
	// if no super type add Object
	ensureSuperTypeObject(element);
	addAnnotations(element);
	if (!element.isInterface()) {
		// if no constructors have been added, add a default constructor
		if (isEmpty(element.getDeclaredConstructors())) {
			JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor();
			constructor.setSimpleName(element.getSimpleName());
			constructor.setVisibility(JvmVisibility.PUBLIC);
			typeExtensions.setSynthetic(constructor, true);
			EObject primarySourceElement = associations.getPrimarySourceElement(element);
			if (primarySourceElement != null) {
				associator.associate(primarySourceElement, constructor);
			}
			element.getMembers().add(constructor);
		}
	}
}
 
Example 6
protected JvmTypeReference getJavaLangObjectTypeRef(JvmType rawType, TypesFactory typesFactory) {
	ResourceSet rs = EcoreUtil2.getResourceSet(rawType);
	JvmParameterizedTypeReference refToObject = typesFactory.createJvmParameterizedTypeReference();
	if (rs != null) {
		EObject javaLangObject = rs.getEObject(javaLangObjectURI, true);
		if (javaLangObject instanceof JvmType) {
			JvmType objectDeclaration = (JvmType) javaLangObject;
			refToObject.setType(objectDeclaration);
			return refToObject;
		}
	}
	JvmGenericType proxy = typesFactory.createJvmGenericType();
	((InternalEObject)proxy).eSetProxyURI(javaLangObjectURI);
	refToObject.setType(proxy);
	return refToObject;
}
 
Example 7
protected JvmTypeReference toTypeReference(final JvmType type, final int arrayDimensions) {
  if ((type == null)) {
    return null;
  }
  JvmParameterizedTypeReference _createJvmParameterizedTypeReference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference();
  final Procedure1<JvmParameterizedTypeReference> _function = (JvmParameterizedTypeReference it) -> {
    it.setType(type);
  };
  JvmTypeReference resultTypeRef = ObjectExtensions.<JvmParameterizedTypeReference>operator_doubleArrow(_createJvmParameterizedTypeReference, _function);
  ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, arrayDimensions, true);
  for (final Integer i : _doubleDotLessThan) {
    {
      final JvmGenericArrayTypeReference arrayRef = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference();
      arrayRef.setComponentType(resultTypeRef);
      resultTypeRef = arrayRef;
    }
  }
  return resultTypeRef;
}
 
Example 8
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createIntAnnotationValue(Object value) {
	JvmIntAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmIntAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof Integer) {
					values.addUnique(element);
				} else if (element != null) {
					values.addUnique(((Number)element).intValue());
				}
			}
		} else if (value instanceof Integer) {
			values.addUnique(value);
		} else if (value instanceof Number) {
			values.addUnique(((Number)value).intValue());
		}
	}
	return annotationValue;
}
 
Example 9
public MutableTypeParameterDeclaration addTypeParameter(final String name, final TypeReference... upperBounds) {
  this.checkMutable();
  ConditionUtils.checkJavaIdentifier(name, "name");
  ConditionUtils.checkIterable(((Iterable<?>)Conversions.doWrapArray(upperBounds)), "upperBounds");
  ConditionUtils.checkInferredTypeReferences("parameter type", upperBounds);
  final JvmTypeParameter param = TypesFactory.eINSTANCE.createJvmTypeParameter();
  param.setName(name);
  this.getDelegate().getTypeParameters().add(param);
  for (final TypeReference upper : upperBounds) {
    {
      final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper);
      final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound();
      jvmUpperBound.setTypeReference(typeRef);
      param.getConstraints().add(jvmUpperBound);
    }
  }
  TypeParameterDeclaration _typeParameterDeclaration = this.getCompilationUnit().toTypeParameterDeclaration(param);
  return ((MutableTypeParameterDeclaration) _typeParameterDeclaration);
}
 
Example 10
public MutableConstructorDeclaration addConstructor(final Procedure1<MutableConstructorDeclaration> initializer) {
  this.checkMutable();
  Preconditions.checkArgument((initializer != null), "initializer cannot be null");
  final Function1<JvmConstructor, Boolean> _function = (JvmConstructor it) -> {
    return Boolean.valueOf(this.getCompilationUnit().getTypeExtensions().isSingleSyntheticDefaultConstructor(it));
  };
  final JvmConstructor constructor = IterableExtensions.<JvmConstructor>findFirst(Iterables.<JvmConstructor>filter(this.getDelegate().getMembers(), JvmConstructor.class), _function);
  if ((constructor != null)) {
    EcoreUtil.remove(constructor);
  }
  final JvmConstructor newConstructor = TypesFactory.eINSTANCE.createJvmConstructor();
  newConstructor.setVisibility(JvmVisibility.PUBLIC);
  newConstructor.setSimpleName(this.getSimpleName());
  this.getDelegate().getMembers().add(newConstructor);
  MemberDeclaration _memberDeclaration = this.getCompilationUnit().toMemberDeclaration(newConstructor);
  final MutableConstructorDeclaration mutableConstructorDeclaration = ((MutableConstructorDeclaration) _memberDeclaration);
  initializer.apply(mutableConstructorDeclaration);
  return mutableConstructorDeclaration;
}
 
Example 11
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createAnnotationAnnotationValue(Object value) {
	JvmAnnotationAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmAnnotationAnnotationValue();
	if (value != null) {
		InternalEList<JvmAnnotationReference> values = (InternalEList<JvmAnnotationReference>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof IAnnotationBinding) {
					values.addUnique(createAnnotationReference((IAnnotationBinding)element));
				}
			}
		} else if (value instanceof IAnnotationBinding) {
			values.addUnique(createAnnotationReference((IAnnotationBinding)value));
		}
	}
	return annotationValue;
}
 
Example 12
Source Project: sarl   Source File: MissedMethodAddModification.java    License: Apache License 2.0 6 votes vote down vote up
private List<JvmTypeParameter> cloneTypeParameters(JvmOperation fromOperation, JvmDeclaredType declaringType) {
	final SARLQuickfixProvider tools = getTools();
	final JvmTypeReferenceBuilder builder1 = tools.getJvmTypeParameterBuilder();
	final JvmTypesBuilder builder2 = tools.getJvmTypeBuilder();
	final TypeReferences builder3 = tools.getTypeServices().getTypeReferences();
	final TypesFactory builder4 = tools.getTypeServices().getTypesFactory();
	final List<JvmTypeParameter> outParameters = new ArrayList<>();
	// Get the type parameter mapping that is a consequence of the super type extension within the container.
	final Map<String, JvmTypeReference> superTypeParameterMapping = new HashMap<>();
	Utils.getSuperTypeParameterMap(declaringType, superTypeParameterMapping);
	Utils.copyTypeParametersFromJvmOperation(
			fromOperation.getTypeParameters(),
			outParameters,
			superTypeParameterMapping,
			builder1, builder2, builder3, builder4);
	return outParameters;
}
 
Example 13
Source Project: xtext-extras   Source File: Proxies.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public JvmType createProxy(BinaryTypeSignature type, Map<String, JvmTypeParameter> typeParameters) {
	String variableName = type.getTypeVariableName();
	if (variableName != null) {
		if (typeParameters == null) {
			throw new IllegalStateException(type.toString());
		}
		JvmType result = typeParameters.get(variableName);
		if (result == null) {
			throw new IllegalStateException(type.toString());
		}
		return result;
	}
	JvmType proxy = typeProxies.get(type);
	if (proxy == null) {
		proxy = TypesFactory.eINSTANCE.createJvmVoid();
		URI uri = type.getURI();
		((InternalEObject) proxy).eSetProxyURI(uri);
		typeProxies.put(type, proxy);
	}
	return proxy;
}
 
Example 14
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
protected JvmType createProxy(ITypeBinding typeBinding) {
	JvmType proxy = typeProxies.get(typeBinding);
	if (proxy == null) {
		if (typeBinding.isPrimitive()) {
			proxy = PRIMITIVE_PROXIES[typeBinding.getKey().charAt(0) - 'B'];
		} else {
			URI uri = uriHelper.getFullURI(typeBinding);
			proxy = COMMON_PROXIES.get(uri.fragment());
			if (proxy == null) {
				proxy = TypesFactory.eINSTANCE.createJvmVoid();
				((InternalEObject)proxy).eSetProxyURI(uri);
			}
		}
		typeProxies.put(typeBinding, proxy);
	}
	return proxy;
}
 
Example 15
protected JvmEnumerationType createEnumerationType(Class<?> clazz) {
	JvmEnumerationType result = TypesFactory.eINSTANCE.createJvmEnumerationType();
	result.internalSetIdentifier(clazz.getName());
	result.setSimpleName(clazz.getSimpleName());
	if (clazz.getDeclaringClass() == null && clazz.getPackage() != null)
		result.setPackageName(clazz.getPackage().getName());
	setVisibility(clazz, result);
	setTypeModifiers(clazz, result);
	createNestedTypes(clazz, result);
	createMethods(clazz, result);
	createFields(clazz, result);
	createConstructors(clazz, result);
	setSuperTypes(clazz, result);
	createAnnotationValues(clazz, result);
	return result;
}
 
Example 16
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createStringAnnotationValue(Object value) {
	JvmStringAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmStringAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof String) {
					values.addUnique(element);
				}
			}
		} else {
			values.addUnique(value);
		}
	}
	return annotationValue;
}
 
Example 17
/**
 * {@inheritDoc}
 * 
 * Returns the value of the 'Type' reference. If there is no type set, 
 * a reference to <code>java.lang.Object</code> is assumed as soon as there is more 
 * than one contained reference.
 * If there is only one contained reference, its type is returned.
 */
@Override
public JvmType getType() {
	if (references != null && !references.isEmpty()) {
		if (references.size() == 1) {
			return references.get(0).getType();
		}
		if (type == null) {
			JvmGenericType objectType = TypesFactory.eINSTANCE.createJvmGenericType();
			String objectClassName = Object.class.getName();
			((InternalEObject) objectType).eSetProxyURI(URIHelperConstants.OBJECTS_URI.appendSegment(objectClassName).appendFragment(objectClassName));
			type = objectType;
		}
	}
	return super.getType();
}
 
Example 18
@Override
public MutableTypeParameterDeclaration addTypeParameter(final String name, final TypeReference... upperBounds) {
  this.checkMutable();
  ConditionUtils.checkJavaIdentifier(name, "name");
  ConditionUtils.checkIterable(((Iterable<?>)Conversions.doWrapArray(upperBounds)), "upperBounds");
  ConditionUtils.checkInferredTypeReferences("parameter type", upperBounds);
  final JvmTypeParameter param = TypesFactory.eINSTANCE.createJvmTypeParameter();
  param.setName(name);
  this.getDelegate().getTypeParameters().add(param);
  for (final TypeReference upper : upperBounds) {
    {
      final JvmTypeReference typeRef = this.getCompilationUnit().toJvmTypeReference(upper);
      final JvmUpperBound jvmUpperBound = TypesFactory.eINSTANCE.createJvmUpperBound();
      jvmUpperBound.setTypeReference(typeRef);
      param.getConstraints().add(jvmUpperBound);
    }
  }
  TypeParameterDeclaration _typeParameterDeclaration = this.getCompilationUnit().toTypeParameterDeclaration(param);
  return ((MutableTypeParameterDeclaration) _typeParameterDeclaration);
}
 
Example 19
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createBooleanAnnotationValue(Object value) {
	JvmBooleanAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmBooleanAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof Boolean) {
					values.addUnique(element);
				}
			}
		} else {
			values.addUnique(value);
		}
	}
	return annotationValue;
}
 
Example 20
Source Project: xtext-eclipse   Source File: JdtBasedTypeFactory.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected JvmAnnotationType createAnnotationProxy(/* @NonNull */ ITypeBinding annotation) {
	JvmAnnotationType proxy = annotationProxies.get(annotation);
	if (proxy == null) {
		URI uri = uriHelper.getFullURI(annotation);
		proxy = ANNOTATION_PROXIES.get(uri.fragment());
		if (proxy == null) {
			proxy = TypesFactory.eINSTANCE.createJvmAnnotationType();
			((InternalEObject)proxy).eSetProxyURI(uri);
		}
		annotationProxies.put(annotation, proxy);
	}
	return proxy;
}
 
Example 21
/**
 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
 * that can be created under this object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
	super.collectNewChildDescriptors(newChildDescriptors, object);

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS,
			 TypesFactory.eINSTANCE.createJvmTypeParameter()));
}
 
Example 22
@Override
public JvmTypeReference getEquivalent() {
	if (equivalent == null) {
		IJvmTypeReferenceProvider provider = getTypeProvider();
		if (provider != null) {
			JvmTypeReference result = provider.getTypeReference(this);
			if (equivalent == null || equivalent != result) {
				if (result != null && (result.eResource() != null || result.eContainer() != null)) {
					JvmDelegateTypeReference delegate = TypesFactory.eINSTANCE.createJvmDelegateTypeReference();
					delegate.setDelegate(result);
					result = delegate;
				}
				if (result != null) {
					boolean wasDeliver = eDeliver();
					try {
						eSetDeliver(false);
						setEquivalent(result);
					} finally {
						eSetDeliver(wasDeliver);
					}
				}
			}
		} else {
			equivalent = null;
		}
	}
	return equivalent;
}
 
Example 23
/**
 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
 * that can be created under this object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
	super.collectNewChildDescriptors(newChildDescriptors, object);

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmPrimitiveType()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmArrayType()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmTypeParameter()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmAnnotationType()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmEnumerationType()));

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_ARRAY_TYPE__COMPONENT_TYPE,
			 TypesFactory.eINSTANCE.createJvmGenericType()));
}
 
Example 24
/**
 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
 * that can be created under this object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
	super.collectNewChildDescriptors(newChildDescriptors, object);

	newChildDescriptors.add
		(createChildParameter
			(TypesPackage.Literals.JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS,
			 TypesFactory.eINSTANCE.createJvmTypeParameter()));
}
 
Example 25
public MutableMethodDeclaration addMethod(final String name, final Procedure1<MutableMethodDeclaration> initializer) {
  this.checkMutable();
  ConditionUtils.checkJavaIdentifier(name, "name");
  Preconditions.checkArgument((initializer != null), "initializer cannot be null");
  final JvmOperation newMethod = TypesFactory.eINSTANCE.createJvmOperation();
  newMethod.setVisibility(JvmVisibility.PUBLIC);
  newMethod.setSimpleName(name);
  newMethod.setReturnType(this.getCompilationUnit().toJvmTypeReference(this.getCompilationUnit().getTypeReferenceProvider().getPrimitiveVoid()));
  this.getDelegate().getMembers().add(newMethod);
  MemberDeclaration _memberDeclaration = this.getCompilationUnit().toMemberDeclaration(newMethod);
  final MutableMethodDeclaration mutableMethodDeclaration = ((MutableMethodDeclaration) _memberDeclaration);
  initializer.apply(mutableMethodDeclaration);
  return mutableMethodDeclaration;
}
 
Example 26
@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);
}
 
Example 27
@Test
public void testJvmTypeNoPackage() {
	Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
	JvmGenericType expected = TypesFactory.eINSTANCE.createJvmGenericType();
	expected.setSimpleName("SimpleName");
	resource.getContents().add(expected);
	JvmType actual = getTypeProvider().findTypeByName("SimpleName");
	assertEquals(expected, actual);
}
 
Example 28
@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);
}
 
Example 29
@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);
}
 
Example 30
@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);
}