[Arakhnę-Dev] [129] Remove deprecated functions. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 129
Author: galland
Date: 2010-02-12 22:44:13 +0100 (Fri, 12 Feb 2010)
Log Message:
-----------
Remove deprecated functions.
Removed Paths:
-------------
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AutoboxingUtil.java
Deleted: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AutoboxingUtil.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AutoboxingUtil.java 2010-02-12 21:43:52 UTC (rev 128)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/AutoboxingUtil.java 2010-02-12 21:44:13 UTC (rev 129)
@@ -1,226 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004-2008 Stéphane GALLAND
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * This program is free software; you can redistribute it and/or modify
- */
-
-package org.arakhne.vmutil;
-
-/**
- * This utility class provides a way to extend the Class class
- * with autoboxing-compliant functions.
- *
- * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
- * @version $Name$ $Revision$ $Date$
- * @since since JDK 1.5
- * @deprecated see {@link ReflectionUtil}
- */
-@Deprecated
-public class AutoboxingUtil {
-
- /**
- * Determines if the specified <code>Object</code> is assignment-compatible
- * with the object represented by the <code>Class</code>. This method extends
- * {@link Class#isInstance(Object)} with autoboxing support.
- *
- * @param type is the class against which the object must be test
- * @param obj is the object to check
- * @return <code>true</code> if <code>obj</code> is an instance of the type
- * @see Class#isInstance(Object)
- */
- public static boolean isInstance(Class<?> type, Object obj) {
- assert(type!=null);
- if (obj==null) return false;
-
- // Test according to the Class's behaviour
- if (type.isInstance(obj)) return true;
-
- // Test according to autoboxing
- if (type.isPrimitive()
- &&
- type!=Void.class && type!=void.class) {
-
- if (type==Boolean.class) return boolean.class.isInstance(obj);
- if (type==boolean.class) return Boolean.class.isInstance(obj);
-
- if (type==Character.class) return char.class.isInstance(obj);
- if (type==char.class) return Character.class.isInstance(obj);
-
- if (type==Byte.class) return byte.class.isInstance(obj);
- if (type==byte.class) return Byte.class.isInstance(obj);
-
- if (type==Short.class) return short.class.isInstance(obj);
- if (type==short.class) return Short.class.isInstance(obj);
-
- if (type==Integer.class) return int.class.isInstance(obj);
- if (type==int.class) return Integer.class.isInstance(obj);
-
- if (type==Long.class) return long.class.isInstance(obj);
- if (type==long.class) return Long.class.isInstance(obj);
-
- if (type==Float.class) return float.class.isInstance(obj);
- if (type==float.class) return Float.class.isInstance(obj);
-
- if (type==Double.class) return double.class.isInstance(obj);
- if (type==double.class) return Double.class.isInstance(obj);
-
- if (type==Void.class) return void.class.isInstance(obj);
- if (type==void.class) return Void.class.isInstance(obj);
-
- assert false: "Unsupported primitive type"; //$NON-NLS-1$
- }
-
- return false;
- }
-
-
- /**
- * Determines if the <code>assignmentTarget</code> object is either the same as,
- * or is a superclass or superinterface of, the class or interface
- * represented by the specified
- * <code>assignementSource</code> parameter. This method extends
- * {@link Class#isAssignableFrom(Class)} with autoboxing support.
- *
- * @param assignementTarget is the class that is tested to be a super class.
- * @param assignementSource is the class that is tested to be a sub class.
- * @return <code>true</code> if an object of the <var>assignementSource</var> type
- * could be assigned to a variable of <var>assignementTarget</var> type,
- * otherwise <code>false</code>.
- */
- public static boolean isAssignableFrom(Class<?> assignementTarget, Class<?> assignementSource) {
- assert(assignementSource!=null);
- assert(assignementTarget!=null);
-
- // Test according to the Class's behaviour
- if (assignementTarget.isAssignableFrom(assignementSource)) return true;
-
- // Test according to autoboxing
- if (assignementTarget.isPrimitive() && assignementSource.isPrimitive()
- &&
- assignementTarget!=Void.class && assignementTarget!=void.class
- &&
- assignementSource!=Void.class && assignementSource!=void.class) {
- return true;
- }
-
- return false;
- }
-
- /** Replies the type that corresponds to the specified class.
- * If the name corresponds to a primitive type, the low-level type
- * will be replied.
- * This method extends
- * {@link Class#forName(String)} with autoboxing support.
- *
- * @param name is the name of the class to load.
- * @return the loaded class
- * @throws ClassNotFoundException if name names an
- * unknown class or primitive
- */
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (name == null || "".equals(name) || "null".equals(name) || "void".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return void.class;
- }
- if ("boolean".equals(name)) { //$NON-NLS-1$
- return boolean.class;
- }
- if ("byte".equals(name)) { //$NON-NLS-1$
- return byte.class;
- }
- if ("char".equals(name)) { //$NON-NLS-1$
- return char.class;
- }
- if ("double".equals(name)) { //$NON-NLS-1$
- return double.class;
- }
- if ("float".equals(name)) { //$NON-NLS-1$
- return float.class;
- }
- if ("int".equals(name)) { //$NON-NLS-1$
- return int.class;
- }
- if ("long".equals(name)) { //$NON-NLS-1$
- return long.class;
- }
- if ("short".equals(name)) { //$NON-NLS-1$
- return short.class;
- }
- return Class.forName(name);
- }
-
- /** Replies the type that corresponds to the specified class.
- * If the name corresponds to a primitive type, the low-level type
- * will be replied.
- * This method extends
- * {@link Class#forName(String)} with autoboxing support.
- *
- * @param name is the name of the class to load.
- * @param loader is the class loader to use.
- * @return the loaded class
- * @throws ClassNotFoundException if name names an
- * unknown class or primitive
- */
- public static Class<?> forName(String name, ClassLoader loader) throws ClassNotFoundException {
- return forName(name, true, loader);
- }
-
- /** Replies the type that corresponds to the specified class.
- * If the name corresponds to a primitive type, the low-level type
- * will be replied.
- * This method extends
- * {@link Class#forName(String)} with autoboxing support.
- *
- * @param name is the name of the class to load.
- * @param typeInitialization must be <code>true</code> to initialize the type, <code>false</code> otherwise.
- * @param loader is the class loader to use.
- * @return the loaded class
- * @throws ClassNotFoundException if name names an
- * unknown class or primitive
- */
- public static Class<?> forName(String name, boolean typeInitialization, ClassLoader loader) throws ClassNotFoundException {
- if (name == null || "".equals(name) || "null".equals(name) || "void".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return void.class;
- }
- if ("boolean".equals(name)) { //$NON-NLS-1$
- return boolean.class;
- }
- if ("byte".equals(name)) { //$NON-NLS-1$
- return byte.class;
- }
- if ("char".equals(name)) { //$NON-NLS-1$
- return char.class;
- }
- if ("double".equals(name)) { //$NON-NLS-1$
- return double.class;
- }
- if ("float".equals(name)) { //$NON-NLS-1$
- return float.class;
- }
- if ("int".equals(name)) { //$NON-NLS-1$
- return int.class;
- }
- if ("long".equals(name)) { //$NON-NLS-1$
- return long.class;
- }
- if ("short".equals(name)) { //$NON-NLS-1$
- return short.class;
- }
- return Class.forName(name, typeInitialization, loader);
- }
-
-}