incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jnee...@apache.org
Subject svn commit: r728747 - /incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
Date Mon, 22 Dec 2008 19:22:37 GMT
Author: jneeraj
Date: Mon Dec 22 11:22:37 2008
New Revision: 728747

URL: http://svn.apache.org/viewvc?rev=728747&view=rev
Log:
IMPERIUS-20: TypeResolver update for String - charsequence interoperability - patches by David
Wood

Modified:
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java?rev=728747&r1=728746&r2=728747&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
Mon Dec 22 11:22:37 2008
@@ -270,7 +270,11 @@
         {
         	if(isReference(leftType))
         	{
-        		if(OBJECT_STRING.equalsIgnoreCase(leftType.getReferenceTypeName()) && isString(rightType))
+//        		if(OBJECT_STRING.equalsIgnoreCase(leftType.getReferenceTypeName()) &&
isString(rightType))
+//        		{
+//        			res = true;
+//        		} 
+        		if (isString(rightType) && isAssignableFromString(leftType)) 
         		{
         			res = true;
         		} 
@@ -286,6 +290,19 @@
         return res;
     }
     
+    private static boolean isAssignableFromString(TypeInfo type) {
+		String typeName = type.getReferenceTypeName();
+		if (typeName != null) {
+			try {
+				Class clazz = type.getClass().forName(typeName);
+				return clazz.isAssignableFrom(String.class);
+			} catch (ClassNotFoundException e) {
+				;
+			}
+		}
+		return false;
+		
+	}    
     public static boolean isTypeAssignableForRelation(TypeInfo leftType,
             TypeInfo rightType)
     {



Mime
View raw message