本文整理汇总了Java中com.sun.jna.ToNativeContext类的典型用法代码示例。如果您正苦于以下问题:Java ToNativeContext类的具体用法?Java ToNativeContext怎么用?Java ToNativeContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToNativeContext类属于com.sun.jna包,在下文中一共展示了ToNativeContext类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
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;
}
示例2: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
public Object toNative(Object arg, ToNativeContext context) {
if (arg == null) {
return null;
}
Pointer ptr = ((NativeObject) arg).getNativeAddress();
return ptr;
}
示例3: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
@Override public Object toNative(Object value, ToNativeContext context) {
return Boolean.TRUE.equals(value) ? 1 : 0;
}
示例4: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
@Override
public Long toNative(Object input, ToNativeContext context) {
return ((JnaLongEnum<?>) input).getValue();
}
示例5: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
@Override
public Integer toNative(Object input, ToNativeContext context) {
return ((KernReturnT) input).getValue();
}
示例6: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
@Override
public Integer toNative(Object input, ToNativeContext context) {
return ((JnaIntEnum<?>) input).getValue();
}
示例7: toNative
import com.sun.jna.ToNativeContext; //导入依赖的package包/类
public Object toNative(Object obj, ToNativeContext ctx) {
final NativeEnum ne = (NativeEnum)obj;
return ne.getNativeValue();
}