Package com.sun.jna

Examples of com.sun.jna.ToNativeConverter


   
    private static Class<? extends Number> primitiveTypeOfID =
        (Class<? extends Number>) new ID().nativeType();
       
    @Test public void convertsNSObjectAsArgumentToID() { 
  ToNativeConverter converter = new ObjCObjectTypeConverter(ObjCObject.class);
      // 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());
    }
View Full Code Here


    }
   
    @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));
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.ToNativeConverter

Copyright © 2018 www.massapicom. 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.