From: adam Date: Sun, 12 Feb 2006 01:19:29 +0000 (-0500) Subject: added isConcrete X-Git-Tag: tag_for_25-Mar~286 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=45b22dc55a5397b1dd14c0083f9abe01f5f8ab0f added isConcrete darcs-hash:20060212011929-5007d-c889070b3c590dffdde3e0bb7528bf6ded0bdebe.gz --- diff --git a/src/edu/berkeley/sbp/util/Reflection.java b/src/edu/berkeley/sbp/util/Reflection.java index de614d0..24ef420 100644 --- a/src/edu/berkeley/sbp/util/Reflection.java +++ b/src/edu/berkeley/sbp/util/Reflection.java @@ -4,8 +4,8 @@ import java.lang.reflect.*; /** Random reflection-related utilities */ public final class Reflection { - - private static Object rebuild(Object o, Class c) { + + public static Object rebuild(Object o, Class c) { //System.out.println("rebuild " + o + " (a " + (o==null?null:o.getClass().getName()) + ") " + c); if (o==null || c.isAssignableFrom(o.getClass())) return o; if ((c == Character.class || c == Character.TYPE) && o instanceof String && ((String)o).length()==1) return new Character(((String)o).charAt(0)); @@ -140,4 +140,10 @@ public final class Reflection { return o+""; } + public static boolean isConcrete(Class c) { + if ((c.getModifiers() & Modifier.ABSTRACT) != 0) return false; + if ((c.getModifiers() & Modifier.INTERFACE) != 0) return false; + return true; + } + }