Pointer g_class = ptr.getPointer(0);
// Now return g_class->gtype
return GType.valueOf(g_class.getNativeLong(0).longValue());
}
public static final Class<? extends NativeObject> classFor(Pointer ptr) {
Pointer g_class = ptr.getPointer(0);
Class<? extends NativeObject> cls;
cls = gTypeInstanceMap.get(g_class);
if (cls != null) {
return cls;
}
GType type = GType.valueOf(g_class.getNativeLong(0).longValue());
logger.finer("Type of " + ptr + " = " + type);
while (cls == null && !type.equals(GType.OBJECT) && !type.equals(GType.INVALID)) {
cls = getTypeMap().get(type);
if (cls != null) {
logger.finer("Found type of " + ptr + " = " + cls);