You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dm...@apache.org on 2002/04/26 02:57:11 UTC
cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util TypeUtils.java
dmitri 02/04/25 17:57:11
Modified: jxpath/src/java/org/apache/commons/jxpath/util
TypeUtils.java
Log:
Fixed String->Primary conversion
Revision Changes Path
1.3 +15 -5 jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/TypeUtils.java
Index: TypeUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/TypeUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TypeUtils.java 24 Apr 2002 04:05:39 -0000 1.2
+++ TypeUtils.java 26 Apr 2002 00:57:11 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/TypeUtils.java,v 1.2 2002/04/24 04:05:39 dmitri Exp $
- * $Revision: 1.2 $
- * $Date: 2002/04/24 04:05:39 $
+ * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/util/TypeUtils.java,v 1.3 2002/04/26 00:57:11 dmitri Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/04/26 00:57:11 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -69,7 +69,7 @@
/**
* @author Dmitri Plotnikov
- * @version $Revision: 1.2 $ $Date: 2002/04/24 04:05:39 $
+ * @version $Revision: 1.3 $ $Date: 2002/04/26 00:57:11 $
*/
public class TypeUtils {
@@ -340,6 +340,16 @@
if (toType.isPrimitive()){
return true;
}
+ if (toType == Boolean.class ||
+ toType == Character.class ||
+ toType == Byte.class ||
+ toType == Short.class ||
+ toType == Integer.class ||
+ toType == Long.class ||
+ toType == Float.class ||
+ toType == Double.class){
+ return true;
+ }
}
else if (object instanceof ExpressionContext){
if (Collection.class.isAssignableFrom(toType)){
@@ -443,7 +453,7 @@
}
else if (object instanceof String){
if (toType == boolean.class || toType == Boolean.class){
- return new Boolean((String)object);
+ return Boolean.valueOf((String)object);
}
if (toType == char.class || toType == Character.class){
return new Character(((String)object).charAt(0));
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>