src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java

Print this page
rev 472 : 8036030: Update JAX-WS RI integration to latest version

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -42,30 +42,34 @@
 
 /**
  * {@link Navigator} implementation for {@code java.lang.reflect}.
  *
  */
-public final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> {
+/*package*/final class ReflectionNavigator implements Navigator<Type, Class, Field, Method> {
 
-    /**
-     * Singleton.
-     *
-     * Use {@link Navigator#REFLECTION}
-     */
-    ReflectionNavigator() {
+//  ----------  Singleton -----------------
+    private static final ReflectionNavigator INSTANCE = new ReflectionNavigator();
+
+    /*package*/static ReflectionNavigator getInstance() {
+        return INSTANCE;
     }
 
+    private ReflectionNavigator() {
+    }
+//  ---------------------------------------
+
     public Class getSuperClass(Class clazz) {
         if (clazz == Object.class) {
             return null;
         }
         Class sc = clazz.getSuperclass();
         if (sc == null) {
             sc = Object.class;        // error recovery
         }
         return sc;
     }
+
     private static final TypeVisitor<Type, Class> baseClassFinder = new TypeVisitor<Type, Class>() {
 
         public Type onClass(Class c, Class sup) {
             // t is a raw type
             if (sup == c) {

@@ -494,11 +498,11 @@
     public boolean hasDefaultConstructor(Class c) {
         try {
             c.getDeclaredConstructor();
             return true;
         } catch (NoSuchMethodException e) {
-            return false;
+            return false; // todo: do this WITHOUT exception throw
         }
     }
 
     public boolean isStaticField(Field field) {
         return Modifier.isStatic(field.getModifiers());

@@ -542,17 +546,18 @@
         } else {
             return name.substring(0, idx);
         }
     }
 
-    public Class findClass(String className, Class referencePoint) {
-        try {
+    @Override
+    public Class loadObjectFactory(Class referencePoint, String pkg) {
             ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint);
-            if (cl == null) {
+        if (cl == null)
                 cl = SecureLoader.getSystemClassLoader();
-            }
-            return cl.loadClass(className);
+
+        try {
+            return cl.loadClass(pkg + ".ObjectFactory");
         } catch (ClassNotFoundException e) {
             return null;
         }
     }