Examples of nativeType()


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

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

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

    static void emitFromNativeConversion(AsmBuilder builder, SkinnyMethodAdapter mv, FromNativeType fromNativeType, Class nativeClass) {
        // If there is a result converter, retrieve it and put on the stack
        FromNativeConverter fromNativeConverter = fromNativeType.fromNativeConverter;
        if (fromNativeConverter != null) {
            convertPrimitive(mv, nativeClass, unboxedType(fromNativeConverter.nativeType()), fromNativeType.nativeType);
            boxValue(builder, mv, fromNativeConverter.nativeType(), nativeClass);

            Method fromNativeMethod = getFromNativeMethod(fromNativeType, builder.getClassLoader());
            getfield(mv, builder, builder.getFromNativeConverterField(fromNativeConverter));
            mv.swap();
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

    static void emitFromNativeConversion(AsmBuilder builder, SkinnyMethodAdapter mv, FromNativeType fromNativeType, Class nativeClass) {
        // If there is a result converter, retrieve it and put on the stack
        FromNativeConverter fromNativeConverter = fromNativeType.fromNativeConverter;
        if (fromNativeConverter != null) {
            convertPrimitive(mv, nativeClass, unboxedType(fromNativeConverter.nativeType()), fromNativeType.nativeType);
            boxValue(builder, mv, fromNativeConverter.nativeType(), nativeClass);

            Method fromNativeMethod = getFromNativeMethod(fromNativeType, builder.getClassLoader());
            getfield(mv, builder, builder.getFromNativeConverterField(fromNativeConverter));
            mv.swap();
            if (fromNativeType.fromNativeContext != null) {
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

                    Class javaType = fromNativeType.getDeclaredType().isPrimitive()
                            ? boxedType(fromNativeType.getDeclaredType())
                            : fromNativeType.getDeclaredType();
                    if (javaType.isAssignableFrom(method.getReturnType())
                            && methodParameterTypes.length == 2
                            && methodParameterTypes[0].isAssignableFrom(fromNativeConverter.nativeType())
                            && methodParameterTypes[1] == FromNativeContext.class
                            && methodIsAccessible(method)
                            && classIsVisible(classLoader, method.getDeclaringClass())) {
                        return method;
                    }
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

    static FromNativeType getParameterType(NativeRuntime runtime, Method m, int idx, TypeMapper typeMapper) {
        Annotation[] annotations = m.getParameterAnnotations()[idx];
        Class declaredJavaClass = m.getParameterTypes()[idx];
        FromNativeConverter converter = getFromNativeConverter(declaredJavaClass, annotations, typeMapper);
        Class javaClass = converter != null ? converter.nativeType() : declaredJavaClass;
        NativeType nativeType = InvokerUtil.getNativeType(runtime, javaClass, annotations);
        return new FromNativeType(declaredJavaClass, nativeType, annotations, converter);
    }

    static com.kenai.jffi.Type getNativeResultType(NativeRuntime runtime, Method m, TypeMapper typeMapper) {
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

        return jffiType(InvokerUtil.getNativeType(runtime, m.getReturnType(), m.getAnnotations()));
    }

    static com.kenai.jffi.Type getNativeParameterType(NativeRuntime runtime, Method m, int idx, TypeMapper typeMapper) {
        FromNativeConverter converter = getFromNativeConverter(m.getParameterTypes()[idx], m.getParameterAnnotations()[idx], typeMapper);
        Class javaClass = converter != null ? converter.nativeType() : m.getReturnType();
        return jffiType(InvokerUtil.getNativeType(runtime, m.getParameterTypes()[idx], m.getParameterAnnotations()[idx]));
    }

    @SuppressWarnings("unchecked")
    static FromNativeConverter getFromNativeConverter(Class javaClass, Annotation[] annotations, TypeMapper typeMapper) {
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

        String invokeMethod ;
        Class nativeReturnType;
        FromNativeConverter resultConverter = resultType.fromNativeConverter;
        Class javaReturnType = resultConverter != null
                ? resultConverter.nativeType() : resultType.getDeclaredType();

        if (NativeType.SCHAR == resultType.nativeType || NativeType.UCHAR == resultType.nativeType
            || NativeType.SSHORT== resultType.nativeType || NativeType.USHORT == resultType.nativeType
            || NativeType.SINT == resultType.nativeType || NativeType.UINT == resultType.nativeType
            || NativeType.VOID == resultType.nativeType) {
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

    static void emitFromNativeConversion(AsmBuilder builder, SkinnyMethodAdapter mv, FromNativeType fromNativeType, Class nativeClass) {
        // If there is a result converter, retrieve it and put on the stack
        FromNativeConverter fromNativeConverter = fromNativeType.getFromNativeConverter();
        if (fromNativeConverter != null) {
            convertPrimitive(mv, nativeClass, unboxedType(fromNativeConverter.nativeType()), fromNativeType.getNativeType());
            boxValue(builder, mv, fromNativeConverter.nativeType(), nativeClass);

            Method fromNativeMethod = getFromNativeMethod(fromNativeType, builder.getClassLoader());
            getfield(mv, builder, builder.getFromNativeConverterField(fromNativeConverter));
            mv.swap();
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

    static void emitFromNativeConversion(AsmBuilder builder, SkinnyMethodAdapter mv, FromNativeType fromNativeType, Class nativeClass) {
        // If there is a result converter, retrieve it and put on the stack
        FromNativeConverter fromNativeConverter = fromNativeType.getFromNativeConverter();
        if (fromNativeConverter != null) {
            convertPrimitive(mv, nativeClass, unboxedType(fromNativeConverter.nativeType()), fromNativeType.getNativeType());
            boxValue(builder, mv, fromNativeConverter.nativeType(), nativeClass);

            Method fromNativeMethod = getFromNativeMethod(fromNativeType, builder.getClassLoader());
            getfield(mv, builder, builder.getFromNativeConverterField(fromNativeConverter));
            mv.swap();
            if (fromNativeType.getFromNativeContext() != null) {
View Full Code Here

Examples of jnr.ffi.mapper.FromNativeConverter.nativeType()

                    Class javaType = fromNativeType.getDeclaredType().isPrimitive()
                            ? boxedType(fromNativeType.getDeclaredType())
                            : fromNativeType.getDeclaredType();
                    if (javaType.isAssignableFrom(method.getReturnType())
                            && methodParameterTypes.length == 2
                            && methodParameterTypes[0].isAssignableFrom(fromNativeConverter.nativeType())
                            && methodParameterTypes[1] == FromNativeContext.class
                            && methodIsAccessible(method)
                            && classIsVisible(classLoader, method.getDeclaringClass())) {
                        return method;
                    }
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.