Examples of toNative()


Examples of com.sun.jna.ToNativeConverter.toNative()

      // We treat all NSObject's equally in toNative, see RococoaTypeMapper
        assertEquals(primitiveTypeOfID, converter.nativeType());
       
  NSObject nsObject = Rococoa.create("NSObject", NSObject.class);

        Number nativeValue = (Number) converter.toNative(nsObject, null);
        assertEquals(primitiveTypeOfID, nativeValue.getClass());
        assertEquals(nsObject.id().longValue(), nativeValue.longValue());
    }
   
    @Test public void convertsNullAsArgumentToNull() {
View Full Code Here

Examples of com.sun.jna.ToNativeConverter.toNative()

   
    @Test public void convertsNullAsArgumentToNull() {
        // Not entirely sure about this, maybe 0 would be better than null,
        // but JNA seems to interpret it properly
  ToNativeConverter converter = new ObjCObjectTypeConverter(ObjCObject.class);
        assertEquals(null, converter.toNative(null, null));
    }
   
    @Test public void convertsReturnedIDToNSObjectSubclass() {
        FromNativeConverter converter = new ObjCObjectTypeConverter(NSNumber.class);
            // returning is based on declared type, see RococoaTypeMapper
View Full Code Here

Examples of org.jruby.ext.ffi.MappedType.toNative()

                throw runtime.newTypeError(value, runtime.fastGetModule("FFI").fastGetClass("Struct"));
            }

        } else if (type instanceof MappedType) {
            MappedType mappedType = (MappedType) type;
            setReturnValue(runtime, mappedType.getRealType(), buffer, mappedType.toNative(runtime.getCurrentContext(), value));

        } else {
            buffer.setLongReturn(0L);
            throw runtime.newRuntimeError("unsupported return type from struct: " + type);
        }
View Full Code Here

Examples of org.rococoa.ID.toNative()

        if (value == null) {
            return null;
        }
        ObjCObject valueAsNSObject = (ObjCObject) value;
        ID idToReturn = valueAsNSObject.id();
        return idToReturn.toNative();
    }
   
    // For tests only
    boolean convertsJavaType(Class<?> javaType) {
        return this.javaType == javaType;
View Full Code Here

Examples of org.rococoa.ID.toNative()

            return null;
        }
        String valueAsString = (String) value;
        ID valueAsID = Foundation.cfString(valueAsString);
        Foundation.sendReturnsID(valueAsID, "autorelease");
        return valueAsID.toNative();
    }
}
View Full Code Here

Examples of org.rococoa.ID.toNative()

    public Object toNative(Object value, ToNativeContext context) {
        if (value == null)
            return null;
        NSObject valueAsNSObject = (NSObject) value;
        ID idToReturn = valueAsNSObject.id();
        return idToReturn.toNative();
    }
   
    // For tests only
    boolean convertsJavaType(Class<?> javaType) {
  return this.javaType == javaType;
View Full Code Here

Examples of org.rococoa.ID.toNative()

        if (value == null)
            return null;
        String valueAsString = (String) value;
        ID valueAsID = Foundation.cfString(valueAsString);
        Foundation.sendReturnsID(valueAsID, "autorelease");
        return valueAsID.toNative();
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.