felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santil...@apache.org
Subject svn commit: r442638 - /incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java
Date Tue, 12 Sep 2006 16:32:18 GMT
Author: santillan
Date: Tue Sep 12 09:32:15 2006
New Revision: 442638

URL: http://svn.apache.org/viewvc?view=rev&rev=442638
Log:
FELIX-141 Replaced Javassist with CGLIB (ASL'd)

Added:
    incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java

Added: incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java?view=auto&rev=442638
==============================================================================
--- incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java
(added)
+++ incubator/felix/trunk/jmxintrospector/src/main/java/org/apache/felix/jmxintrospector/JmxAsmHelper.java
Tue Sep 12 09:32:15 2006
@@ -0,0 +1,28 @@
+package org.apache.felix.jmxintrospector;
+
+import java.util.Hashtable;
+
+import org.objectweb.asm.Type;
+
+public class JmxAsmHelper {
+	private static Hashtable<String, Class> primitives=new Hashtable<String, Class>();
+
+	static{
+		primitives.put("long", Long.TYPE);
+		primitives.put("boolean", Boolean.TYPE);
+		primitives.put("short", Short.TYPE);
+		primitives.put("int", Integer.TYPE);
+		primitives.put("float", Float.TYPE);
+		primitives.put("double", Double.TYPE);
+		primitives.put("char", Character.TYPE);
+		primitives.put("primitive", Byte.TYPE);
+		primitives.put("void", Void.TYPE);
+	}
+	public static Type getAsmType(String jmxType) throws ClassNotFoundException{
+		//FIXME: does it work with primitive arrays? and with multidimensional ones?
+		Class clazz;
+		if(primitives.containsKey(jmxType)) clazz=primitives.get(jmxType);
+		else clazz=Class.forName(jmxType, true, JmxAsmHelper.class.getClassLoader());
+		return Type.getType(clazz);
+	}
+}



Mime
View raw message