Examples of fromNative()


Examples of com.sun.jna.FromNativeConverter.fromNative()

  NSNumber number = Rococoa.create("NSNumber", NSNumber.class, "numberWithInt:", 45);

        // We can cope with 64 bits on 64 and 32
        Number nativeValue = new Long(number.id().longValue());
        NSNumber converted = (NSNumber) converter.fromNative(nativeValue, null);
        assertEquals(converted.id(), number.id());
        assertEquals(45, converted.intValue());       

        // We must cope with 32 bits on 32-bit
        if (NativeLong.SIZE == 4) {
View Full Code Here

Examples of com.sun.jna.FromNativeConverter.fromNative()

        assertEquals(45, converted.intValue());       

        // We must cope with 32 bits on 32-bit
        if (NativeLong.SIZE == 4) {
            nativeValue = new Integer(number.id().intValue());
            converted = (NSNumber) converter.fromNative(nativeValue, null);
            assertEquals(45, converted.intValue());       
        }   
    }
   
    @Test public void convertsReturnedNilToNull() {
View Full Code Here

Examples of com.sun.jna.FromNativeConverter.fromNative()

   
    @Test public void convertsReturnedNilToNull() {
  // Again I'm not sure that this is desirable, but it is what happens.
        FromNativeConverter converter = new ObjCObjectTypeConverter(NSNumber.class);
        Number nativeValue = new Long(0);
        assertNull(converter.fromNative(nativeValue, null));
    }
   
    @Test public void returnedNSObjectIsNormallyRetained() {
        FromNativeConverter converter = new ObjCObjectTypeConverter(NSNumber.class);
View Full Code Here

Examples of com.sun.jna.FromNativeConverter.fromNative()

        FromNativeConverter converter = new ObjCObjectTypeConverter(NSNumber.class);

  NSNumber number = Rococoa.create("NSNumber", NSNumber.class, "numberWithInt:", 45);
  assertRetainCount(2, number); // one for the pool, one for Java

        NSNumber converted = (NSNumber) converter.fromNative(new Long(number.id().longValue()), null);
  assertRetainCount(3, converted); // now we have another Java alias
  assertRetainCount(3, number);
    }
   
    @Test public void returnedNSObjectIsNotRetainedIfMethodImpliesWeOwnIt() {
View Full Code Here

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

                        new IRubyObject[] { new Pointer(runtime, memory) },
                        Block.NULL_BLOCK);

        } else if (type instanceof MappedType) {
            MappedType mappedType = (MappedType) type;
            return mappedType.fromNative(runtime.getCurrentContext(), fromNative(runtime, mappedType.getRealType(), buffer, index));

        } else {
            throw runtime.newTypeError("unsupported callback parameter type: " + type);
        }
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.