Java Code Examples for org.eclipse.xtext.common.types.JvmTypeReference#eIsProxy()

The following examples show how to use org.eclipse.xtext.common.types.JvmTypeReference#eIsProxy() . 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
Source File: JvmTypesBuilder.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a clone of the given {@link JvmTypeReference} without resolving any proxies.
 * The clone will be associated with the original element by means of {@link JvmModelAssociator associations}.
 * 
 * @param typeRef the type reference to be cloned.
 * @return a clone of typeRef, <code>null</code> if typeRef is <code>null</code> or a {@link JvmUnknownTypeReference} 
 *     if there is a problem with the typeRef. 
 */
/* @Nullable */ 
public JvmTypeReference cloneWithProxies(/* @Nullable */ JvmTypeReference typeRef) {
	if(typeRef == null)
		return null;
	if (typeRef instanceof JvmParameterizedTypeReference && !typeRef.eIsProxy()
			&& !typeRef.eIsSet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE)) {
		JvmUnknownTypeReference unknownTypeReference = typesFactory.createJvmUnknownTypeReference();
		return unknownTypeReference;
	}
	return cloneAndAssociate(typeRef);
}
 
Example 2
Source File: JvmDelegateTypeReferenceImplCustom.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public JvmType getType() {
	JvmTypeReference resolvedDelegate = getDelegate();
	if (resolvedDelegate == null || resolvedDelegate.eIsProxy())
		return null;
	return resolvedDelegate.getType();
}
 
Example 3
Source File: JvmDelegateTypeReferenceImplCustom.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String getIdentifier() {
	JvmTypeReference resolvedDelegate = getDelegate();
	if (resolvedDelegate == null || resolvedDelegate.eIsProxy())
		return null;
	return resolvedDelegate.getIdentifier();
}
 
Example 4
Source File: JvmDelegateTypeReferenceImplCustom.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String getQualifiedName(char innerClassDelimiter) {
	JvmTypeReference resolvedDelegate = getDelegate();
	if (resolvedDelegate == null || resolvedDelegate.eIsProxy())
		return null;
	return resolvedDelegate.getQualifiedName(innerClassDelimiter);
}
 
Example 5
Source File: JvmDelegateTypeReferenceImplCustom.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String getSimpleName() {
	JvmTypeReference resolvedDelegate = getDelegate();
	if (resolvedDelegate == null || resolvedDelegate.eIsProxy())
		return null;
	return resolvedDelegate.getSimpleName();
}
 
Example 6
Source File: SARLEarlyExitComputer.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEarlyExitEvent(JvmTypeReference reference) {
	if (reference != null && !reference.eIsProxy()) {
		final JvmType type = reference.getType();
		return isEarlyExitAnnotatedElement(type);
	}
	return false;
}
 
Example 7
Source File: AbstractBuilder.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Replies if the given object is a valid type reference.
 */
@Pure
protected boolean isTypeReference(JvmTypeReference typeReference) {
	return (typeReference != null && !typeReference.eIsProxy()
		&& typeReference.getType() != null && !typeReference.getType().eIsProxy());
}
 
Example 8
Source File: InheritanceHelper.java    From sarl with Apache License 2.0 3 votes vote down vote up
/** Replies if the type candidate is a proxy (unresolved type) or a subtype of the given super type.
 *
 * @param candidate the type to test.
 * @param jvmSuperType the expected JVM super-type.
 * @param sarlSuperType the expected SARL super-type.
 * @param onlyInterface <code>true</code> if only interface types are matching; <code>false</code> if
 *     not-interface types are matching.
 * @return <code>true</code> if the candidate is a sub-type of the super-type.
 */
public boolean isProxyOrSubTypeOf(JvmTypeReference candidate, Class<?> jvmSuperType,
		Class<? extends XtendTypeDeclaration> sarlSuperType, boolean onlyInterface) {
	if (candidate.eIsProxy()) {
		return true;
	}
	return isSubTypeOf(candidate, jvmSuperType, sarlSuperType, onlyInterface);
}