cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5479] Avoiding instantiating the classes
Date Fri, 06 Jun 2014 13:15:01 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 187d35e7f -> b46641c6f


[CXF-5479] Avoiding instantiating the classes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b46641c6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b46641c6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b46641c6

Branch: refs/heads/master
Commit: b46641c6f9a20f5ad73626b507b9db4db242ec45
Parents: 187d35e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jun 6 14:14:44 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jun 6 14:14:44 2014 +0100

----------------------------------------------------------------------
 .../cxf/maven_plugin/javatowadl/Java2WADLMojo.java  | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b46641c6/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
index 5ec4025..f9053fe 100644
--- a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
+++ b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
@@ -30,9 +30,7 @@ import java.util.List;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.helpers.FileUtils;
-import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.wadl.DocumentationProvider;
 import org.apache.cxf.jaxrs.model.wadl.WadlGenerator;
@@ -274,30 +272,26 @@ public class Java2WADLMojo extends AbstractMojo {
     
     private void getResourcesList() throws MojoExecutionException {
         for (String className : classResourceNames) {
-            Object bean = null;
+            Class<?> beanClass = null;
             try {
-                bean = getClassLoader().loadClass(className).newInstance();
+                beanClass = getClassLoader().loadClass(className);
             } catch (Exception e) {
                 throw new MojoExecutionException(e.getMessage(), e);
             } 
-            Class<?> realClass = ClassHelper.getRealClass(bean);
-            ClassResourceInfo cri = getCreatedFromModel(realClass);
+            ClassResourceInfo cri = getCreatedFromModel(beanClass);
             if (cri != null) {
                 if (!InjectionUtils.isConcreteClass(cri.getServiceClass())) {
                     cri = new ClassResourceInfo(cri);
                     classResourceInfos.add(cri);
                 }
-                cri.setResourceClass(bean.getClass());
-                cri.setResourceProvider(new SingletonResourceProvider(bean));
+                cri.setResourceClass(beanClass);
                 continue;
             }
             
-            cri = ResourceUtils.createClassResourceInfo(bean.getClass(), realClass, true,
true,
+            cri = ResourceUtils.createClassResourceInfo(beanClass, beanClass, true, true,
                                                         getBus());
             if (cri != null) {
                 classResourceInfos.add(cri);
-                cri.setResourceProvider(
-                                   new SingletonResourceProvider(bean));
             }
         }
     }


Mime
View raw message