jdk/src/share/classes/java/beans/ReflectionUtils.java
changeset 18341 79b25b16e048
parent 18340 c43a394d9c72
parent 17289 4dec41b3c5e3
child 18342 31ddc9c9eb12
--- a/jdk/src/share/classes/java/beans/ReflectionUtils.java	Sun Apr 28 08:16:45 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2003, 2009, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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 General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package java.beans;
-
-import java.lang.reflect.Field;
-
-/**
- * A utility class for reflectively finding methods, constuctors and fields
- * using reflection.
- */
-class ReflectionUtils {
-
-    @SuppressWarnings("rawtypes")
-    public static boolean isPrimitive(Class type) {
-        return primitiveTypeFor(type) != null;
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static Class primitiveTypeFor(Class wrapper) {
-        if (wrapper == Boolean.class) return Boolean.TYPE;
-        if (wrapper == Byte.class) return Byte.TYPE;
-        if (wrapper == Character.class) return Character.TYPE;
-        if (wrapper == Short.class) return Short.TYPE;
-        if (wrapper == Integer.class) return Integer.TYPE;
-        if (wrapper == Long.class) return Long.TYPE;
-        if (wrapper == Float.class) return Float.TYPE;
-        if (wrapper == Double.class) return Double.TYPE;
-        if (wrapper == Void.class) return Void.TYPE;
-        return null;
-    }
-
-    /**
-     * Returns the value of a private field.
-     *
-     * @param instance object instance
-     * @param cls class
-     * @param name name of the field
-     * @param el an exception listener to handle exceptions; or null
-     * @return value of the field; null if not found or an error is encountered
-     */
-    @SuppressWarnings("rawtypes")
-    public static Object getPrivateField(Object instance, Class cls,
-                                         String name, ExceptionListener el) {
-        try {
-            Field f = cls.getDeclaredField(name);
-            f.setAccessible(true);
-            return f.get(instance);
-        }
-        catch (Exception e) {
-            if (el != null) {
-                el.exceptionThrown(e);
-            }
-        }
-        return null;
-    }
-}