db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r581405 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java
Date Tue, 02 Oct 2007 22:03:55 GMT
Author: arminw
Date: Tue Oct  2 15:03:54 2007
New Revision: 581405

URL: http://svn.apache.org/viewvc?rev=581405&view=rev
Log:
add new method

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java?rev=581405&r1=581404&r2=581405&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/ClassHelper.java Tue
Oct  2 15:03:54 2007
@@ -445,4 +445,26 @@
         }
         return result;
     }
+
+    /**
+     * Attention: This method is different from {@link Class#getSuperclass()}!!
+     * Returns the non-primitiv, non-interface super class of the specified source class,
+     * else <em>null</em> is returned. If the super-class is <code>java.lang.Object</code>
+     * <em>null</em> is returned too.
+     *
+     * @param source The source class
+     * @return The non-primitiv, non-interface, non-java.lang.Object super class of the source
class
+     */
+    public static Class getSuperClass(Class source)
+    {
+        Class superClass = source.getSuperclass();
+        if(superClass != null
+                && !superClass.isInterface()
+                && !superClass.isPrimitive()
+                && !superClass.equals(Object.class))
+        {
+            return superClass;
+        }
+        return null;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message