java-gobject-introspection r33 - trunk/src/org/gnome/gir/gobject



Author: walters
Date: Fri Sep  5 16:59:13 2008
New Revision: 33
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=33&view=rev

Log:
Delete unused dynamic type mapping code


Modified:
   trunk/src/org/gnome/gir/gobject/GType.java
   trunk/src/org/gnome/gir/gobject/NativeObject.java

Modified: trunk/src/org/gnome/gir/gobject/GType.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GType.java	(original)
+++ trunk/src/org/gnome/gir/gobject/GType.java	Fri Sep  5 16:59:13 2008
@@ -45,39 +45,15 @@
 
 package org.gnome.gir.gobject;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
 import com.sun.jna.FromNativeContext;
 import com.sun.jna.NativeLong;
-import com.sun.jna.Pointer;
 
 /**
  *
  */
 public class GType extends NativeLong {
 	private static final long serialVersionUID = 1L;
-	
-    private static final Map<Pointer, Class<? extends NativeObject>> instanceMap
-    	= new ConcurrentHashMap<Pointer, Class<? extends NativeObject>>();	
-    private static final Map<GType, Class<? extends NativeObject>> typeMap 
-    	= new HashMap<GType, Class<? extends NativeObject>>();
-    
-    public static final Class<? extends NativeObject> classFor(Pointer ptr) {
-        Pointer g_class = ptr.getPointer(0);
-        Class<? extends NativeObject> cls;
-        cls = instanceMap.get(g_class);
-        if (cls != null) {
-            return cls;
-        }
-        return cls;
-    };
-    
-    public static final void registerMapped(GType type, Class<? extends NativeObject> klass) {
-    	typeMap.put(type, klass);
-    };
-    
+
     public static final void init() {
     	GObjectAPI.gobj.g_type_init();
     }

Modified: trunk/src/org/gnome/gir/gobject/NativeObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/NativeObject.java	(original)
+++ trunk/src/org/gnome/gir/gobject/NativeObject.java	Fri Sep  5 16:59:13 2008
@@ -201,13 +201,8 @@
          */
         if (GObject.GObjectProxy.class.isAssignableFrom(cls)) {
         	cls = (Class<T>) getStubClassFor(cls);
-        /* For GObject, read the g_class field to find
-         * the most exact class match
-         */        	
-        } else if (GObject.class.isAssignableFrom(cls)) {
-            cls = classFor(ptr, cls);
         }
-        /* Ok, something else, let's try to find an Initializer constructor
+        /* Ok, let's try to find an Initializer constructor
          */
         try {
             Constructor<T> constructor = cls.getDeclaredConstructor(Initializer.class);
@@ -228,13 +223,7 @@
         }
 
     }
-    
-    @SuppressWarnings("unchecked")
-    protected static <T extends NativeObject> Class<T> classFor(Pointer ptr, Class<T> defaultClass) {
-        Class<? extends NativeObject> cls = GType.classFor(ptr);
-        return (cls != null && defaultClass.isAssignableFrom(cls)) ? (Class<T>) cls : defaultClass; 
-    }
-    
+
     @Override
     public boolean equals(Object o) {
         return o instanceof NativeObject && ((NativeObject) o).handle.equals(handle);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]