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

项目:java-gobject    文件:GTypeMapper.java   
@SuppressWarnings(value = "unchecked")
public Object fromNative(Object result, FromNativeContext context) {
    if (result == null) {
        return null;
    }
    if (context instanceof FunctionResultContext) {
        return NativeObject.Internals.objectFor((Pointer) result, context.getTargetType(), true);
    }            
    if (context instanceof CallbackParameterContext || context instanceof StructureReadContext) {
        return NativeObject.Internals.objectFor((Pointer) result, context.getTargetType(), false);
    }
    if (context instanceof MethodResultContext) {
        throw new RuntimeException("Got illegal MethodResultContext in GTypeMapper");
    }            
    throw new IllegalStateException("Cannot convert to NativeObject from " + context);
}