Java 类com.sun.jna.ToNativeContext 实例源码

项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    Pointer ptr = ((NativeObject) arg).handle();

    //
    // Deal with any adjustments to the proxy neccessitated by gstreamer
    // breaking their reference-counting idiom with special cases
    //
    if (context instanceof MethodParameterContext) {
        MethodParameterContext mcontext = (MethodParameterContext) context;
        Method method = mcontext.getMethod();
        int index = mcontext.getParameterIndex();
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        if (index < parameterAnnotations.length) {
            Annotation[] annotations = parameterAnnotations[index];
            for (int i = 0; i < annotations.length; ++i) {
                if (annotations[i] instanceof Invalidate) {
                    ((Handle) arg).invalidate();
                    break;
                } else if (annotations[i] instanceof IncRef) {
                    ((RefCountedObject) arg).ref();
                    break;
                }
            }
        }
    }
    return ptr;
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
@SuppressWarnings("rawtypes")
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    return EnumMapper.getInstance().intValue((Enum) arg);
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    URI uri = (URI) arg0;
    String uriString = uri.toString();
    // Need to fixup file:/ to be file:/// for gstreamer
    if ("file".equals(uri.getScheme()) && uri.getHost() == null) {
        final String path = uri.getRawPath();
        if (com.sun.jna.Platform.isWindows()) {
            uriString = "file:/" + path;
        } else {
            uriString = "file://" + path;
        }
    }
    return uriString;
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    Pointer ptr = ((NativeObject) arg).handle();

    //
    // Deal with any adjustments to the proxy neccessitated by gstreamer
    // breaking their reference-counting idiom with special cases
    //
    if (context instanceof MethodParameterContext) {
        MethodParameterContext mcontext = (MethodParameterContext) context;
        Method method = mcontext.getMethod();
        int index = mcontext.getParameterIndex();
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        if (index < parameterAnnotations.length) {
            Annotation[] annotations = parameterAnnotations[index];
            for (int i = 0; i < annotations.length; ++i) {
                if (annotations[i] instanceof Invalidate) {
                    ((Handle) arg).invalidate();
                    break;
                } else if (annotations[i] instanceof IncRef) {
                    ((RefCountedObject) arg).ref();
                    break;
                }
            }
        }
    }
    return ptr;
}
项目:gst1-java-core    文件:GTypeMapper.java   
@SuppressWarnings("rawtypes")
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    return EnumMapper.getInstance().intValue((Enum) arg);
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    URI uri = (URI) arg0;
    String uriString = uri.toString();
    // Need to fixup file:/ to be file:/// for gstreamer
    if ("file".equals(uri.getScheme()) && uri.getHost() == null) {
        final String path = uri.getRawPath();
        if (com.sun.jna.Platform.isWindows()) {
            uriString = "file:/" + path;
        } else {
            uriString = "file://" + path;
        }
    }
    return uriString;
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    Pointer ptr = ((NativeObject) arg).getNativeAddress();
    return ptr;
}
项目:java-gobject    文件:GTypeMapper.java   
@SuppressWarnings("unchecked")
public Object toNative(Object arg, ToNativeContext context) {
    if (arg == null) {
        return null;
    }
    return EnumMapper.getInstance().intValue((Enum) arg);
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    URI uri = (URI) arg0;
    String uriString = uri.toString();
    // Need to fixup file:/ to be file:/// for gstreamer
    if ("file".equals(uri.getScheme()) && uri.getHost() == null) {
        final String path = uri.getRawPath();
        if (com.sun.jna.Platform.isWindows()) {
            uriString = "file:/" + path;
        } else {
            uriString = "file://" + path;
        }
    }
    return uriString;
}
项目:incubator-netbeans    文件:GnomeKeyringLibrary.java   
@Override public Object toNative(Object value, ToNativeContext context) {
    return Boolean.TRUE.equals(value) ? 1 : 0;
}
项目:DigitalMediaServer    文件:JnaLongEnumConverter.java   
@Override
public Long toNative(Object input, ToNativeContext context) {
    return ((JnaLongEnum<?>) input).getValue();
}
项目:DigitalMediaServer    文件:KernReturnTConverter.java   
@Override
public Integer toNative(Object input, ToNativeContext context) {
    return ((KernReturnT) input).getValue();
}
项目:DigitalMediaServer    文件:JnaIntEnumConverter.java   
@Override
public Integer toNative(Object input, ToNativeContext context) {
    return ((JnaIntEnum<?>) input).getValue();
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return arg != null ? ((NativeValue) arg).nativeValue() : null;
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext arg1) {
    return arg != null ? ((ClockTime) arg).convertTo(TimeUnit.NANOSECONDS) : 0L;
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    // Let the default String -> native conversion handle it
    return arg;            
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return Integer.valueOf(Boolean.TRUE.equals(arg) ? 1 : 0);
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    return ((GQuark) arg0).intValue();
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((IntPtr)arg).value;            
}
项目:gstreamer1.x-java    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((QueryType)arg).intValue();
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return arg != null ? ((NativeValue) arg).nativeValue() : null;
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext arg1) {
    return arg != null ? ((ClockTime) arg).convertTo(TimeUnit.NANOSECONDS) : 0L;
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    // Let the default String -> native conversion handle it
    return arg;            
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return Integer.valueOf(Boolean.TRUE.equals(arg) ? 1 : 0);
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    return ((GQuark) arg0).intValue();
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((IntPtr)arg).value;            
}
项目:gst1-java-core    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((QueryType)arg).intValue();
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return arg != null ? ((NativeValue) arg).nativeValue() : null;
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return Integer.valueOf(((Boolean) arg).booleanValue() ? 1 : 0);
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg0, ToNativeContext arg1) {
    return ((GQuark) arg0).intValue();
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((IntPtr)arg).value;            
}
项目:java-gobject    文件:GTypeMapper.java   
public Object toNative(Object arg, ToNativeContext context) {
    return ((Date)arg).getTime();            
}
项目:jpraat    文件:NativeEnumConverter.java   
public Object toNative(Object obj, ToNativeContext ctx) {
    final NativeEnum ne = (NativeEnum)obj;
    return ne.getNativeValue();
}