[jboss-cvs] JBossAS SVN: r98934 - in projects/jboss-reflect/trunk: src/main/java/org/jboss/reflect/plugins and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 25 08:06:25 EST 2009


Author: kabir.khan at jboss.com
Date: 2009-12-25 08:06:24 -0500 (Fri, 25 Dec 2009)
New Revision: 98934

Added:
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.java
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTest.java
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomValueValueOfTest.java
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValueValueOfTest.java
Modified:
   projects/jboss-reflect/trunk/.classpath
   projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ValueConvertor.java
Log:
[JBREFLECT-88] Fix the call to invoke the valueOf() method made by ValueConvertor

Modified: projects/jboss-reflect/trunk/.classpath
===================================================================
--- projects/jboss-reflect/trunk/.classpath	2009-12-24 12:59:04 UTC (rev 98933)
+++ projects/jboss-reflect/trunk/.classpath	2009-12-25 13:06:24 UTC (rev 98934)
@@ -1,18 +1,18 @@
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
   <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.8.1.GA/javassist-3.8.1.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.11.0.GA/javassist-3.11.0.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.16.GA/jboss-common-core-2.2.16.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 </classpath>
\ No newline at end of file

Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ValueConvertor.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ValueConvertor.java	2009-12-24 12:59:04 UTC (rev 98933)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/ValueConvertor.java	2009-12-25 13:06:24 UTC (rev 98934)
@@ -147,7 +147,7 @@
          int modifiers = method.getModifiers();
          if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)
                && clazz.isAssignableFrom(method.getReturnType()))
-            return ReflectionUtils.invoke(null, method, new Object[]{value});
+            return ReflectionUtils.invoke(method, null, new Object[]{value});
       }
       catch (Exception ignored)
       {

Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.java	                        (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/CustomValueOf.java	2009-12-25 13:06:24 UTC (rev 98934)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.classinfo.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class CustomValueOf
+{
+   String string;
+   
+   private CustomValueOf(String string)
+   {
+      super();
+      this.string = string;
+   }
+
+   public static CustomValueOf valueOf(String string)
+   {
+      return new CustomValueOf(string);
+   }
+
+   public String getString()
+   {
+      return string;
+   }
+}

Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTest.java	                        (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/CustomValueValueOfTest.java	2009-12-25 13:06:24 UTC (rev 98934)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.classinfo.test;
+
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.test.classinfo.support.CustomValueOf;
+
+
+/**
+ * Tests that public static XXX.valueOf(Object o) is called when calling ClassInfo.convertValue()
+ *  
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class CustomValueValueOfTest extends AbstractClassInfoTest
+{
+   public CustomValueValueOfTest(String name)
+   {
+      super(name);
+   }
+   
+   public void testCustomValueOf() throws Throwable
+   {
+      TypeInfo info = getTypeInfoFactory().getTypeInfo(CustomValueOf.class);
+      Object value = info.convertValue("1234");
+      assertNotNull(value);
+      assertInstanceOf(value, CustomValueOf.class);
+      assertEquals("1234", ((CustomValueOf)value).getString());
+   }
+
+}

Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomValueValueOfTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomValueValueOfTest.java	                        (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/IntrospectionCustomValueValueOfTest.java	2009-12-25 13:06:24 UTC (rev 98934)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.classinfo.test;
+
+import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class IntrospectionCustomValueValueOfTest extends CustomValueValueOfTest
+{
+   public IntrospectionCustomValueValueOfTest(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected TypeInfoFactory getTypeInfoFactory()
+   {
+      return new IntrospectionTypeInfoFactory();
+   }
+}

Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValueValueOfTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValueValueOfTest.java	                        (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/JavassistCustomValueValueOfTest.java	2009-12-25 13:06:24 UTC (rev 98934)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.classinfo.test;
+
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class JavassistCustomValueValueOfTest extends CustomValueValueOfTest
+{
+   public JavassistCustomValueValueOfTest(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected TypeInfoFactory getTypeInfoFactory()
+   {
+      return new JavassistTypeInfoFactory();
+   }
+}




More information about the jboss-cvs-commits mailing list