public ICoercer getCoercerInternal(IType lhsType, IType rhsType, boolean runtime) { lhsType = TypeSystem.getTypeFromJavaBackedType(lhsType); rhsType = TypeSystem.getTypeFromJavaBackedType(rhsType); if (TypeSystem.isDeleted(lhsType) || TypeSystem.isDeleted(rhsType)) { return null; } ICoercer coercer = super.getCoercerInternal(lhsType, rhsType, runtime); if (coercer != null) { return coercer; } //TODO-dp this coercion needs to be upgraded and removed //============================================================================= // IEntityType <- MetaType<IEntityType> //============================================================================= IType entityType = TypeSystem.getByFullNameIfValid("gw.entity.IEntityType"); if (entityType != null && entityType.equals(lhsType) && rhsType instanceof IMetaType && CommonServices.getEntityAccess().isEntityClass(((IMetaType) rhsType).getType())) { return IdentityCoercer.instance(); } return null; }
private ICoercer findCoercerImpl( IType lhsType, IType rhsType, boolean runtime ) { ICoercer coercer = getCoercerInternal( lhsType, rhsType, runtime ); if( coercer != null ) { return coercer; } //Look at interfaces on rhsType for coercions IType[] interfaces = rhsType.getInterfaces(); for ( IType anInterface1 : interfaces ) { coercer = findCoercer(lhsType, anInterface1, runtime); if (coercer != null) { return coercer; } } //Recurse to the superclass of rhsType for coercions if( rhsType.getSupertype() == null || isPrimitiveOrBoxed( lhsType ) ) { return null; } else { return findCoercer( lhsType, rhsType.getSupertype(), runtime ); } }
private ICoercer findCoercerImpl( IType lhsType, IType rhsType, boolean runtime ) { ICoercer coercer = getCoercerInternal( lhsType, rhsType, runtime ); if( coercer != null ) { return coercer; } //Look at interfaces on rhsType for coercions IType[] interfaces = rhsType.getInterfaces(); for ( IType anInterface1 : interfaces ) { coercer = findCoercer(lhsType, anInterface1, runtime); if (coercer != null) { return coercer; } } //Recurse to the superclass of rhsType for coercions if( rhsType.getSupertype() == null || isPrimitiveOrBoxed( lhsType ) ) { return null; } else { return findCoercer( lhsType, rhsType.getSupertype(), runtime ); } }
ICoercer coercerInternal = getCoercerInternal( lhsType, rhsType.getTypeParameters()[1], runtime ); if( coercerInternal != null ) JavaTypes.IFEATURE_REFERENCE().isAssignableFrom( rhsType ) && (lhsType.isAssignableFrom( rhsType.getTypeParameters()[1] ) || getCoercerInternal( lhsType, rhsType.getTypeParameters()[1], runtime ) != null) ) { return FeatureReferenceToBlockCoercer.instance(); JavaTypes.IMETHOD_REFERENCE().isAssignableFrom( rhsType ) ) ICoercer coercer = getCoercerInternal( lhsType.getTypeParameters()[1], rhsType.getTypeParameters()[1], runtime ); if( coercer != null )