<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FReflection%2FException</id>
		<title>Java/Reflection/Exception - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FReflection%2FException"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Reflection/Exception&amp;action=history"/>
		<updated>2026-04-17T21:22:15Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Reflection/Exception&amp;diff=6083&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Reflection/Exception&amp;diff=6083&amp;oldid=prev"/>
				<updated>2010-06-01T06:01:55Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:01, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Reflection/Exception&amp;diff=6082&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Reflection/Exception&amp;diff=6082&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Check whether given exception is compatible with the exceptions declared in a throws clause ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.lang.reflect.Array;&lt;br /&gt;
import java.util.Arrays;&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright 2002-2007 the original author or authors.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 * you may not use this file except in compliance with the License.&lt;br /&gt;
 * You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
//Revised from springframework&lt;br /&gt;
/**&lt;br /&gt;
 * Miscellaneous object utility methods. Mainly for internal use within the&lt;br /&gt;
 * framework; consider Jakarta&amp;quot;s Commons Lang for a more comprehensive suite&lt;br /&gt;
 * of object utilities.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Juergen Hoeller&lt;br /&gt;
 * @author Keith Donald&lt;br /&gt;
 * @author Rod Johnson&lt;br /&gt;
 * @author Rob Harrop&lt;br /&gt;
 * @author Alex Ruiz&lt;br /&gt;
 * @since 19.03.2004&lt;br /&gt;
 * @see org.apache.rumons.lang.ObjectUtils&lt;br /&gt;
 */&lt;br /&gt;
abstract class ObjectUtils {&lt;br /&gt;
  private static final int INITIAL_HASH = 7;&lt;br /&gt;
  private static final int MULTIPLIER = 31;&lt;br /&gt;
  private static final String EMPTY_STRING = &amp;quot;&amp;quot;;&lt;br /&gt;
  private static final String NULL_STRING = &amp;quot;null&amp;quot;;&lt;br /&gt;
  private static final String ARRAY_START = &amp;quot;{&amp;quot;;&lt;br /&gt;
  private static final String ARRAY_END = &amp;quot;}&amp;quot;;&lt;br /&gt;
  private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;&lt;br /&gt;
  private static final String ARRAY_ELEMENT_SEPARATOR = &amp;quot;, &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Check whether the given exception is compatible with the exceptions&lt;br /&gt;
   * declared in a throws clause.&lt;br /&gt;
   * @param ex the exception to checked&lt;br /&gt;
   * @param declaredExceptions the exceptions declared in the throws clause&lt;br /&gt;
   * @return whether the given exception is compatible&lt;br /&gt;
   */&lt;br /&gt;
  public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions) {&lt;br /&gt;
    if (!isCheckedException(ex)) {&lt;br /&gt;
      return true;&lt;br /&gt;
    }&lt;br /&gt;
    if (declaredExceptions != null) {&lt;br /&gt;
      for (int i = 0; i &amp;lt; declaredExceptions.length; i++) {&lt;br /&gt;
        if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {&lt;br /&gt;
          return true;&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Return whether the given throwable is a checked exception:&lt;br /&gt;
   * that is, neither a RuntimeException nor an Error.&lt;br /&gt;
   * @param ex the throwable to check&lt;br /&gt;
   * @return whether the throwable is a checked exception&lt;br /&gt;
   * @see java.lang.Exception&lt;br /&gt;
   * @see java.lang.RuntimeException&lt;br /&gt;
   * @see java.lang.Error&lt;br /&gt;
   */&lt;br /&gt;
  public static boolean isCheckedException(Throwable ex) {&lt;br /&gt;
    return !(ex instanceof RuntimeException || ex instanceof Error);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Get StackTraceElement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
//                                                                            //&lt;br /&gt;
//                             C l a s s U t i l                              //&lt;br /&gt;
//                                                                            //&lt;br /&gt;
//  Copyright (C) Herve Bitteur 2000-2009. All rights reserved.               //&lt;br /&gt;
//  This software is released under the GNU General Public License.           //&lt;br /&gt;
//  Please contact users@audiveris.dev.java.net to report bugs &amp;amp; suggestions. //&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Class &amp;lt;code&amp;gt;ClassUtil&amp;lt;/code&amp;gt; provides utilities related to Class handling.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Herv&amp;amp;eacute Bitteur&lt;br /&gt;
 * @version $Id: ClassUtil.java,v 1.3 2009/03/03 19:45:51 hbitteur Exp $&lt;br /&gt;
 */&lt;br /&gt;
public class ClassUtil&lt;br /&gt;
{&lt;br /&gt;
    //~ Methods ----------------------------------------------------------------&lt;br /&gt;
    //-----------------//&lt;br /&gt;
    // getCallingFrame //&lt;br /&gt;
    //-----------------//&lt;br /&gt;
    /**&lt;br /&gt;
     * Infer the calling frame, skipping the given classes if so provided.&lt;br /&gt;
     * Code was derived from a private method found in the JDK Logger class&lt;br /&gt;
     *&lt;br /&gt;
     * @param skippedClasses the classes to skip&lt;br /&gt;
     * @return the frame found, just before the skipped classes (or just before&lt;br /&gt;
     * the caller of this method)&lt;br /&gt;
     */&lt;br /&gt;
    public static StackTraceElement getCallingFrame (Class... skippedClasses)&lt;br /&gt;
    {&lt;br /&gt;
        // Get the current stack trace.&lt;br /&gt;
        StackTraceElement[] stack = (new Throwable()).getStackTrace();&lt;br /&gt;
        // Simple case, no classes to skip, just return the caller of the caller&lt;br /&gt;
        if (skippedClasses.length == 0) {&lt;br /&gt;
            return stack[2];&lt;br /&gt;
        }&lt;br /&gt;
        // More complex case, return the caller, just before the skipped classes&lt;br /&gt;
        // First, search back to a method in the skipped classes, if any&lt;br /&gt;
        int ix;&lt;br /&gt;
        searchingForSkipped: &lt;br /&gt;
        for (ix = 0; ix &amp;lt; stack.length; ix++) {&lt;br /&gt;
            StackTraceElement frame = stack[ix];&lt;br /&gt;
            String            cname = frame.getClassName();&lt;br /&gt;
            for (Class skipped : skippedClasses) {&lt;br /&gt;
                if (cname.equals(skipped.getName())) {&lt;br /&gt;
                    break searchingForSkipped;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        // Now search for the first frame before the skipped classes&lt;br /&gt;
        searchingForNonSkipped: &lt;br /&gt;
        for (; ix &amp;lt; stack.length; ix++) {&lt;br /&gt;
            StackTraceElement frame = stack[ix];&lt;br /&gt;
            String            cname = frame.getClassName();&lt;br /&gt;
            for (Class skipped : skippedClasses) {&lt;br /&gt;
                if (cname.equals(skipped.getName())) {&lt;br /&gt;
                    continue searchingForNonSkipped;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            // We&amp;quot;ve found the relevant frame.&lt;br /&gt;
            return frame;&lt;br /&gt;
        }&lt;br /&gt;
        // We haven&amp;quot;t found a suitable frame&lt;br /&gt;
        return null;&lt;br /&gt;
    }&lt;br /&gt;
    //--------//&lt;br /&gt;
    // nameOf //&lt;br /&gt;
    //--------//&lt;br /&gt;
    /**&lt;br /&gt;
     * Report the full name of the object class, without the package information&lt;br /&gt;
     *&lt;br /&gt;
     * @param obj the object to name&lt;br /&gt;
     * @return the concatenation of (enclosing) simple names&lt;br /&gt;
     */&lt;br /&gt;
    public static String nameOf (Object obj)&lt;br /&gt;
    {&lt;br /&gt;
        StringBuilder sb = new StringBuilder();&lt;br /&gt;
        for (Class cl = obj.getClass(); cl != null;&lt;br /&gt;
             cl = cl.getEnclosingClass()) {&lt;br /&gt;
            if (sb.length() &amp;gt; 0) {&lt;br /&gt;
                sb.insert(0, &amp;quot;-&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            sb.insert(0, cl.getSimpleName());&lt;br /&gt;
        }&lt;br /&gt;
        return sb.toString();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Is Checked Exception ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.lang.reflect.Array;&lt;br /&gt;
import java.util.Arrays;&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright 2002-2007 the original author or authors.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 * you may not use this file except in compliance with the License.&lt;br /&gt;
 * You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
//Revised from springframework&lt;br /&gt;
/**&lt;br /&gt;
 * Miscellaneous object utility methods. Mainly for internal use within the&lt;br /&gt;
 * framework; consider Jakarta&amp;quot;s Commons Lang for a more comprehensive suite&lt;br /&gt;
 * of object utilities.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Juergen Hoeller&lt;br /&gt;
 * @author Keith Donald&lt;br /&gt;
 * @author Rod Johnson&lt;br /&gt;
 * @author Rob Harrop&lt;br /&gt;
 * @author Alex Ruiz&lt;br /&gt;
 * @since 19.03.2004&lt;br /&gt;
 * @see org.apache.rumons.lang.ObjectUtils&lt;br /&gt;
 */&lt;br /&gt;
abstract class ObjectUtils {&lt;br /&gt;
  private static final int INITIAL_HASH = 7;&lt;br /&gt;
  private static final int MULTIPLIER = 31;&lt;br /&gt;
  private static final String EMPTY_STRING = &amp;quot;&amp;quot;;&lt;br /&gt;
  private static final String NULL_STRING = &amp;quot;null&amp;quot;;&lt;br /&gt;
  private static final String ARRAY_START = &amp;quot;{&amp;quot;;&lt;br /&gt;
  private static final String ARRAY_END = &amp;quot;}&amp;quot;;&lt;br /&gt;
  private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;&lt;br /&gt;
  private static final String ARRAY_ELEMENT_SEPARATOR = &amp;quot;, &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  /**&lt;br /&gt;
   * Return whether the given throwable is a checked exception:&lt;br /&gt;
   * that is, neither a RuntimeException nor an Error.&lt;br /&gt;
   * @param ex the throwable to check&lt;br /&gt;
   * @return whether the throwable is a checked exception&lt;br /&gt;
   * @see java.lang.Exception&lt;br /&gt;
   * @see java.lang.RuntimeException&lt;br /&gt;
   * @see java.lang.Error&lt;br /&gt;
   */&lt;br /&gt;
  public static boolean isCheckedException(Throwable ex) {&lt;br /&gt;
    return !(ex instanceof RuntimeException || ex instanceof Error);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Utilities to use Java reflection without all of the checked exceptions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.lang.reflect.Array;&lt;br /&gt;
import java.lang.reflect.Method;&lt;br /&gt;
/* &lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one&lt;br /&gt;
 * or more contributor license agreements.  See the NOTICE file&lt;br /&gt;
 * distributed with this work for additional information&lt;br /&gt;
 * regarding copyright ownership.  The ASF licenses this file&lt;br /&gt;
 * to you under the Apache License, Version 2.0 (the&lt;br /&gt;
 * &amp;quot;License&amp;quot;); you may not use this file except in compliance&lt;br /&gt;
 * with the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 * http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing,&lt;br /&gt;
 * software distributed under the License is distributed on an&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY&lt;br /&gt;
 * KIND, either express or implied.  See the License for the&lt;br /&gt;
 * specific language governing permissions and limitations&lt;br /&gt;
 * under the License.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 * ReflectUtils is a collection of utilities that allows you to leverage Java&lt;br /&gt;
 * reflection without all of the checked exceptions (they are converted to&lt;br /&gt;
 * runtime exceptions or return values). This class was created to get around&lt;br /&gt;
 * the fact that the classes in java.lang.reflect.* turn every event into an&lt;br /&gt;
 * exception, which is often cumbersome or inaccurate.&lt;br /&gt;
 * &lt;br /&gt;
 * @author Dan Jemiolo (danj)&lt;br /&gt;
 * &lt;br /&gt;
 */&lt;br /&gt;
class ReflectUtils {&lt;br /&gt;
  //&lt;br /&gt;
  // The class loader used by this class&lt;br /&gt;
  //&lt;br /&gt;
  private static final ClassLoader _DEFAULT_CLASS_LOADER;&lt;br /&gt;
  //&lt;br /&gt;
  // The class loader used by this class&lt;br /&gt;
  //&lt;br /&gt;
  private static ReflectUtilHelper _helper = null;&lt;br /&gt;
  static {&lt;br /&gt;
    //&lt;br /&gt;
    // load the default class loader (we need an instance to do so)&lt;br /&gt;
    //&lt;br /&gt;
    ReflectUtils instance = new ReflectUtils();&lt;br /&gt;
    _DEFAULT_CLASS_LOADER = instance.getClass().getClassLoader();&lt;br /&gt;
    _helper = null;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param className&lt;br /&gt;
   *          The qualified name of the class to search for.&lt;br /&gt;
   * &lt;br /&gt;
   * @return True if the class is in the JVM&amp;quot;s classpath.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static boolean exists(String className) {&lt;br /&gt;
    if (_helper != null)&lt;br /&gt;
      return _helper.exists(className);&lt;br /&gt;
    try {&lt;br /&gt;
      Class.forName(className);&lt;br /&gt;
      return true;&lt;br /&gt;
    }&lt;br /&gt;
    catch (ClassNotFoundException error) {&lt;br /&gt;
      return false;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param className&lt;br /&gt;
   *          The qualified name of the class to search for.&lt;br /&gt;
   * &lt;br /&gt;
   * @param classLoader&lt;br /&gt;
   *          The class loader to use in the class lookup.&lt;br /&gt;
   * &lt;br /&gt;
   * @return True if the class is in the JVM&amp;quot;s classpath.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static boolean exists(String className, ClassLoader classLoader) {&lt;br /&gt;
    try {&lt;br /&gt;
      classLoader.loadClass(className);&lt;br /&gt;
      return true;&lt;br /&gt;
    }&lt;br /&gt;
    catch (ClassNotFoundException error) {&lt;br /&gt;
      return false;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param theClass&lt;br /&gt;
   *          A &amp;quot;normal&amp;quot;, non-array type.&lt;br /&gt;
   * &lt;br /&gt;
   * @return The array version of the given type. For example, if you pass&lt;br /&gt;
   *         &amp;lt;em&amp;gt;String.class&amp;lt;/em&amp;gt;, you get &amp;lt;em&amp;gt;String[].class&amp;lt;/em&amp;gt;. If&lt;br /&gt;
   *         you pass &amp;lt;em&amp;gt;int.class&amp;lt;/em&amp;gt;, you get &amp;lt;em&amp;gt;int[].class&amp;lt;/em&amp;gt;. If&lt;br /&gt;
   *         the given class is already an array type, it is returned.&lt;br /&gt;
   * &lt;br /&gt;
   * @see #getClassFromArrayClass(Class)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Class getArrayClassFromClass(Class theClass) {&lt;br /&gt;
    if (theClass.isArray())&lt;br /&gt;
      return theClass;&lt;br /&gt;
    return Array.newInstance(theClass, 0).getClass();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * This method calls getClass(Class, ClassLoader) with this class&amp;quot;&lt;br /&gt;
   * ClassLoader.&lt;br /&gt;
   * &lt;br /&gt;
   * @param className&lt;br /&gt;
   *          The name of the class to load.&lt;br /&gt;
   * &lt;br /&gt;
   * @return The Class representing the given class name. A RuntimeException is&lt;br /&gt;
   *         thrown if the class is not found.&lt;br /&gt;
   * &lt;br /&gt;
   * @see #exists(String)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Class getClass(String className) {&lt;br /&gt;
    if (_helper != null) {&lt;br /&gt;
      Class clazz = _helper.getClass(className);&lt;br /&gt;
      if (clazz != null)&lt;br /&gt;
        return clazz;&lt;br /&gt;
    }&lt;br /&gt;
    return getClass(className, _DEFAULT_CLASS_LOADER);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param className&lt;br /&gt;
   *          The name of the class to load.&lt;br /&gt;
   * &lt;br /&gt;
   * @param classLoader&lt;br /&gt;
   *          The class loader to use for class lookup.&lt;br /&gt;
   * &lt;br /&gt;
   * @return The Class representing the given class name. A RuntimeException is&lt;br /&gt;
   *         thrown if the class is not found.&lt;br /&gt;
   * &lt;br /&gt;
   * @see #exists(String)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Class getClass(String className, ClassLoader classLoader) {&lt;br /&gt;
    try {&lt;br /&gt;
      return classLoader.loadClass(className);&lt;br /&gt;
    }&lt;br /&gt;
    catch (Throwable error) {&lt;br /&gt;
      //&lt;br /&gt;
      // if it failed, try the default loader, if applicable&lt;br /&gt;
      //&lt;br /&gt;
      if (_helper != null) {&lt;br /&gt;
        Class clzz = _helper.getClass(className);&lt;br /&gt;
        if (clzz != null)&lt;br /&gt;
          return clzz;&lt;br /&gt;
      }&lt;br /&gt;
      if (classLoader != _DEFAULT_CLASS_LOADER) {&lt;br /&gt;
        try {&lt;br /&gt;
          return _DEFAULT_CLASS_LOADER.loadClass(className);&lt;br /&gt;
        }&lt;br /&gt;
        catch (Throwable error2) {&lt;br /&gt;
          //&lt;br /&gt;
          // still failed - ignore this one and throw from the&lt;br /&gt;
          // original error&lt;br /&gt;
          //&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      Object[] filler = { className };&lt;br /&gt;
      String message = &amp;quot;JavaClassNotFound&amp;quot;;&lt;br /&gt;
      throw new RuntimeException(message);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param arrayClass&lt;br /&gt;
   *          The array version of a given type (&amp;lt;em&amp;gt;YourType[].class&amp;lt;/em&amp;gt;)&lt;br /&gt;
   * &lt;br /&gt;
   * @return The non-array version of the given type. For example, if you pass&lt;br /&gt;
   *         &amp;lt;em&amp;gt;String[].class&amp;lt;/em&amp;gt;, you get &amp;lt;em&amp;gt;String.class&amp;lt;/em&amp;gt;. If&lt;br /&gt;
   *         you pass &amp;lt;em&amp;gt;int[].class&amp;lt;/em&amp;gt;, you get &amp;lt;em&amp;gt;int.class&amp;lt;/em&amp;gt;.&lt;br /&gt;
   * &lt;br /&gt;
   * @see #getArrayClassFromClass(Class)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Class getClassFromArrayClass(Class arrayClass) {&lt;br /&gt;
    if (arrayClass == null)&lt;br /&gt;
      throw new NullPointerException(&amp;quot;NullClass&amp;quot;);&lt;br /&gt;
    String name = arrayClass.getName();&lt;br /&gt;
    //&lt;br /&gt;
    // make sure it&amp;quot;s an array type&lt;br /&gt;
    //&lt;br /&gt;
    if (name.charAt(0) != &amp;quot;[&amp;quot;) {&lt;br /&gt;
      Object[] filler = { name };&lt;br /&gt;
      throw new RuntimeException(&amp;quot;NotArrayClass&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    if (name.charAt(1) == &amp;quot;[&amp;quot;) {&lt;br /&gt;
      Object[] filler = { name };&lt;br /&gt;
      throw new RuntimeException(&amp;quot;NoMultiArrays&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    //&lt;br /&gt;
    // the char after the [ signifies the type of the array. these&lt;br /&gt;
    // values are documented with java.lang.Class.getName()&lt;br /&gt;
    //&lt;br /&gt;
    char type = name.charAt(1);&lt;br /&gt;
    switch (type) {&lt;br /&gt;
    case &amp;quot;Z&amp;quot;:&lt;br /&gt;
      return boolean.class;&lt;br /&gt;
    case &amp;quot;B&amp;quot;:&lt;br /&gt;
      return byte.class;&lt;br /&gt;
    case &amp;quot;C&amp;quot;:&lt;br /&gt;
      return char.class;&lt;br /&gt;
    case &amp;quot;D&amp;quot;:&lt;br /&gt;
      return double.class;&lt;br /&gt;
    case &amp;quot;F&amp;quot;:&lt;br /&gt;
      return float.class;&lt;br /&gt;
    case &amp;quot;I&amp;quot;:&lt;br /&gt;
      return int.class;&lt;br /&gt;
    case &amp;quot;J&amp;quot;:&lt;br /&gt;
      return long.class;&lt;br /&gt;
    case &amp;quot;S&amp;quot;:&lt;br /&gt;
      return short.class;&lt;br /&gt;
    case &amp;quot;L&amp;quot;:&lt;br /&gt;
      return getClass(name.substring(2, name.length() - 1));&lt;br /&gt;
    default:&lt;br /&gt;
      Object[] filler = { name, new Character(type) };&lt;br /&gt;
      String message = &amp;quot;UnsupportedType&amp;quot;;&lt;br /&gt;
      throw new RuntimeException(message);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static Method getFirstMethod(Class theClass, String name) {&lt;br /&gt;
    Method[] methods = theClass.getMethods();&lt;br /&gt;
    for (int n = 0; n &amp;lt; methods.length; ++n)&lt;br /&gt;
      if (name.equals(methods[n].getName()))&lt;br /&gt;
        return methods[n];&lt;br /&gt;
    return null;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param theClass&lt;br /&gt;
   * &lt;br /&gt;
   * @return The full name of the Java package that contains the given class, or&lt;br /&gt;
   *         null if the class is not in a package.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static String getPackageName(Class theClass) {&lt;br /&gt;
    //&lt;br /&gt;
    // NOTE: Using the Package would be the easiest way to get this&lt;br /&gt;
    // data, but the ClassLoader is not required to provide it. Thus,&lt;br /&gt;
    // we use the more reliable method of parsing the class name.&lt;br /&gt;
    //&lt;br /&gt;
    //&lt;br /&gt;
    // arrays will have the [ as part of their name - no good&lt;br /&gt;
    //&lt;br /&gt;
    if (theClass.isArray())&lt;br /&gt;
      theClass = getClassFromArrayClass(theClass);&lt;br /&gt;
    return getPackageName(theClass.getName());&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param qualifiedName&lt;br /&gt;
   * &lt;br /&gt;
   * @return The full name of the Java package that contains the given class, or&lt;br /&gt;
   *         null if the class is not in a package.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static String getPackageName(String qualifiedName) {&lt;br /&gt;
    int dot = qualifiedName.lastIndexOf(&amp;quot;.&amp;quot;);&lt;br /&gt;
    return dot &amp;gt;= 0 ? qualifiedName.substring(0, dot) : null;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param type&lt;br /&gt;
   * &lt;br /&gt;
   * @return The unqualified (local) name of the class/interface. If the type is&lt;br /&gt;
   *         an array, the [] characters will be appended.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static String getShortName(Class type) {&lt;br /&gt;
    if (type.isArray()) {&lt;br /&gt;
      Class base = getClassFromArrayClass(type);&lt;br /&gt;
      String name = getShortName(base);&lt;br /&gt;
      return name + &amp;quot;[]&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    return getShortName(type.getName());&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * @param qualifiedName&lt;br /&gt;
   * &lt;br /&gt;
   * @return The unqualified (local) name.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static String getShortName(String qualifiedName) {&lt;br /&gt;
    int dot = qualifiedName.lastIndexOf(&amp;quot;.&amp;quot;);&lt;br /&gt;
    return qualifiedName.substring(dot + 1);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * Invokes the Class.newInstance() method on the given Class.&lt;br /&gt;
   * &lt;br /&gt;
   * @param theClass&lt;br /&gt;
   *          The type to instantiate.&lt;br /&gt;
   * &lt;br /&gt;
   * @return An object of the given type, created with the default constructor.&lt;br /&gt;
   *         A RuntimeException is thrown if the object could not be created.&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Object newInstance(Class theClass) {&lt;br /&gt;
    try {&lt;br /&gt;
      return theClass.newInstance();&lt;br /&gt;
    }&lt;br /&gt;
    catch (InstantiationException error) {&lt;br /&gt;
      Object[] filler = { theClass };&lt;br /&gt;
      String message = &amp;quot;ObjectCreationFailed&amp;quot;;&lt;br /&gt;
      throw new RuntimeException(message);&lt;br /&gt;
    }&lt;br /&gt;
    catch (IllegalAccessException error) {&lt;br /&gt;
      Object[] filler = { theClass };&lt;br /&gt;
      String message = &amp;quot;DefaultConstructorHidden&amp;quot;;&lt;br /&gt;
      throw new RuntimeException(message);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * This is a convenience method that invokes newInstance(Class) with a Class&lt;br /&gt;
   * object representing the given type.&lt;br /&gt;
   * &lt;br /&gt;
   * @see #getClass(String, ClassLoader)&lt;br /&gt;
   * @see #newInstance(Class)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Object newInstance(String className) {&lt;br /&gt;
    return newInstance(getClass(className));&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * This is a convenience method that invokes newInstance(Class) with a Class&lt;br /&gt;
   * object loaded by the given ClassLoader&lt;br /&gt;
   * &lt;br /&gt;
   * @see #getClass(String, ClassLoader)&lt;br /&gt;
   * @see #newInstance(Class)&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static Object newInstance(String className, ClassLoader classLoader) {&lt;br /&gt;
    return newInstance(getClass(className, classLoader));&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * &lt;br /&gt;
   * This is a setter for the helper object&lt;br /&gt;
   * &lt;br /&gt;
   */&lt;br /&gt;
  public static void setHelper(ReflectUtilHelper helper) {&lt;br /&gt;
    _helper = helper;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 * @author Joel Hawkins&lt;br /&gt;
 * &lt;br /&gt;
 */&lt;br /&gt;
interface ReflectUtilHelper {&lt;br /&gt;
  boolean exists(String className);&lt;br /&gt;
  Class getClass(String className);&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== whether method declares the given exception or one of its superclasses ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright 2002-2008 the original author or authors.&lt;br /&gt;
 *&lt;br /&gt;
 * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;);&lt;br /&gt;
 * you may not use this file except in compliance with the License.&lt;br /&gt;
 * You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
import java.lang.reflect.Field;&lt;br /&gt;
import java.lang.reflect.InvocationTargetException;&lt;br /&gt;
import java.lang.reflect.Method;&lt;br /&gt;
import java.lang.reflect.Modifier;&lt;br /&gt;
import java.sql.SQLException;&lt;br /&gt;
import java.util.Arrays;&lt;br /&gt;
import java.util.LinkedList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
/**&lt;br /&gt;
 * Simple utility class for working with the reflection API and handling&lt;br /&gt;
 * reflection exceptions.&lt;br /&gt;
 *&lt;br /&gt;
 * &amp;lt;p&amp;gt;Only intended for internal use.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Juergen Hoeller&lt;br /&gt;
 * @author Rob Harrop&lt;br /&gt;
 * @author Rod Johnson&lt;br /&gt;
 * @author Costin Leau&lt;br /&gt;
 * @since 1.2.2&lt;br /&gt;
 */&lt;br /&gt;
public abstract class ReflectionUtils {&lt;br /&gt;
  /**&lt;br /&gt;
   * Determine whether the given method explicitly declares the given exception&lt;br /&gt;
   * or one of its superclasses, which means that an exception of that type&lt;br /&gt;
   * can be propagated as-is within a reflective invocation.&lt;br /&gt;
   * @param method the declaring method&lt;br /&gt;
   * @param exceptionType the exception to throw&lt;br /&gt;
   * @return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the exception can be thrown as-is;&lt;br /&gt;
   * &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; if it needs to be wrapped&lt;br /&gt;
   */&lt;br /&gt;
  public static boolean declaresException(Method method, Class exceptionType) {&lt;br /&gt;
    Class[] declaredExceptions = method.getExceptionTypes();&lt;br /&gt;
    for (int i = 0; i &amp;lt; declaredExceptions.length; i++) {&lt;br /&gt;
      Class declaredException = declaredExceptions[i];&lt;br /&gt;
      if (declaredException.isAssignableFrom(exceptionType)) {&lt;br /&gt;
        return true;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>