@MarshalsPointer public static long toNative(CFType o, long flags) { if (o == null) { return 0L; } if ((flags & (CALL_TYPE_CALLBACK | CALL_TYPE_GLOBAL_VALUE | CALL_TYPE_STRUCT_MEMBER)) > 0) { // Make sure the object outlives the GC o.retain(); } return o.getHandle(); } }
static CFType toObject(Class<? extends CFType> cls, long handle, long flags, boolean retain) { if (handle == 0) { return null; } long typeId = getTypeID(handle); Class<? extends CFType> cfTypeClass = allCFTypeClasses.get(typeId); if (cfTypeClass != null && cfTypeClass != cls) { if (cls.isAssignableFrom(cfTypeClass)) { /* * Only use cfTypeClass if it's a subclass of the expected * type (cls). */ cls = cfTypeClass; } } CFType o = (CFType) NativeObject.Marshaler.toObject(cls, handle, flags); if (retain) { retain(handle); } return o; } @MarshalsPointer
@MarshalsPointer public static long toNative(CFType o, long flags) { if (o == null) { return 0L; } if ((flags & (CALL_TYPE_CALLBACK | CALL_TYPE_GLOBAL_VALUE | CALL_TYPE_STRUCT_MEMBER)) > 0) { // Make sure the object outlives the GC o.retain(); } return o.getHandle(); } }
@MarshalsPointer public static long toNative(CFType o, long flags) { if (o == null) { return 0L; } if ((flags & (CALL_TYPE_CALLBACK | CALL_TYPE_GLOBAL_VALUE | CALL_TYPE_STRUCT_MEMBER)) > 0) { // Make sure the object outlives the GC o.retain(); } return o.getHandle(); } }
static CFType toObject(Class<? extends CFType> cls, long handle, long flags, boolean retain) { if (handle == 0) { return null; } long typeId = getTypeID(handle); Class<? extends CFType> cfTypeClass = allCFTypeClasses.get(typeId); if (cfTypeClass != null && cfTypeClass != cls) { if (cls.isAssignableFrom(cfTypeClass)) { /* * Only use cfTypeClass if it's a subclass of the expected * type (cls). */ cls = cfTypeClass; } } CFType o = (CFType) NativeObject.Marshaler.toObject(cls, handle, flags); if (retain) { retain(handle); } return o; } @MarshalsPointer
static CFType toObject(Class<? extends CFType> cls, long handle, long flags, boolean retain) { if (handle == 0) { return null; } long typeId = getTypeID(handle); Class<? extends CFType> cfTypeClass = allCFTypeClasses.get(typeId); if (cfTypeClass != null && cfTypeClass != cls) { if (cls.isAssignableFrom(cfTypeClass)) { /* * Only use cfTypeClass if it's a subclass of the expected * type (cls). */ cls = cfTypeClass; } } CFType o = (CFType) NativeObject.Marshaler.toObject(cls, handle, flags); if (retain) { retain(handle); } return o; } @MarshalsPointer