当前位置: 首页>>代码示例>>Java>>正文


Java MsgSend类代码示例

本文整理汇总了Java中com.apple.jobjc.Invoke.MsgSend的典型用法代码示例。如果您正苦于以下问题:Java MsgSend类的具体用法?Java MsgSend怎么用?Java MsgSend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MsgSend类属于com.apple.jobjc.Invoke包,在下文中一共展示了MsgSend类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDoubleIntLongMethod

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testDoubleIntLongMethod(){
    final MyObject instObj = new MyObjectClass(runtime).alloc();

    final int arg1 = 3;
    final long arg2 = 4;
    final float arg3 = 5.5F;
    final double expected = 12.5D;

    final MsgSend sel = new MsgSend(runtime, "add:and:and:", DoubleCoder.INST,
            SIntCoder.INST, SLongLongCoder.INST, FloatCoder.INST);
    sel.init(ctx, instObj);
    SIntCoder.INST.push(ctx, arg1);
    SLongLongCoder.INST.push(ctx, arg2);
    FloatCoder.INST.push(ctx, arg3);
    sel.invoke(ctx);
    final double ret = DoubleCoder.INST.pop(ctx);
    assertEquals(expected, ret);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:SubclassingTest.java

示例2: writeBody

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
@Override public void writeBody(final PrintStream out) {
    Set<String> written = new HashSet<String>();
    for(final Method method : this.clazz.instanceMethods)
        if(written.add(method.name))
            FunctionGenerator.writeOutFunction(out, MsgSend.class, method, "this");
        else
            System.out.format("Duplicate method: %1$s %2$s -%3$s\n", clazz.parent.name, className, method.name);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:JObjCClassFile.java

示例3: writeBody

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
@Override public void writeBody(final PrintStream out) {
    Set<String> written = new HashSet<String>();
    for(final Method method : this.clazz.classMethods)
        if(written.add(method.name))
            FunctionGenerator.writeOutFunction(out, MsgSend.class, method, "this");
        else
            System.out.format("Duplicate method: %1$s %2$s -%3$s\n", clazz.parent.name, className, method.name);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:JObjCClassClassFile.java

示例4: testGetBlackColor

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testGetBlackColor() throws Throwable {
    final MacOSXFramework appKit = TestUtils.getAppKit();
    final NSClass<? extends ID> clazz = UnsafeRuntimeAccess.getNSClass(appKit, "NSColor");
    final MsgSend sel = UnsafeRuntimeAccess.createMsgSend(clazz, "redColor", PointerCoder.INST);

    sel.init(nativeBuffer, clazz);
    sel.invoke(nativeBuffer);

    final long blackColorPtr = PrimitivePointerCoder.INST.pop(nativeBuffer);
    String dscr = UnsafeRuntimeAccess.getDescriptionForPtr(blackColorPtr);

    System.out.println("0x" + Long.toHexString(blackColorPtr) + ": " + dscr);
    assertEquals("NSCalibratedRGBColorSpace 1 0 0 1", dscr);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:SELTest.java

示例5: testVoidVoidMethod

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testVoidVoidMethod(){
    final MyObject instObj = new MyObjectClass(runtime).alloc();

    assertEquals(0, instObj.myMethodHits);
    MsgSend sel = new MsgSend(runtime, "myMethod", VoidCoder.INST);
    sel.init(ctx, instObj);
    sel.invoke(ctx);
    assertEquals(1, instObj.myMethodHits);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SubclassingTest.java

示例6: testVoidIntMethod

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testVoidIntMethod(){
    final MyObject instObj = new MyObjectClass(runtime).alloc();

    MsgSend sel2 = new MsgSend(runtime, "intMethod", SIntCoder.INST);
    sel2.init(ctx, instObj);
    sel2.invoke(ctx);
    int ret = SIntCoder.INST.popInt(ctx);
    assertEquals(3, ret);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SubclassingTest.java

示例7: testStructStructMethod

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testStructStructMethod(){
    final MyObject instObj = new MyObjectClass(runtime).alloc();

    NSPoint p = JObjC.getInstance().Foundation().NSMakePoint(3, 3);

    MsgSend sel2 = new MsgSend(runtime, "doubleIt:", p.getCoder(), p.getCoder());
    sel2.init(ctx, instObj);
    p.getCoder().push(ctx, p);
    sel2.invoke(ctx, p);

    assertEquals(6.0, p.x());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:SubclassingTest.java

示例8: testNSStringNSStringMethod

import com.apple.jobjc.Invoke.MsgSend; //导入依赖的package包/类
public void testNSStringNSStringMethod(){
    final MyObject instObj = new MyObjectClass(runtime).alloc();

    final NSString orig = Utils.get().strings().nsString("foobar");
    final String expected = "foobarfoobarfoobar";

    final MsgSend sel = new MsgSend(runtime, "stringTimesThree:", IDCoder.INST, IDCoder.INST);
    sel.init(ctx, instObj);
    IDCoder.INST.push(ctx, orig);
    sel.invoke(ctx);
    NSString ret = (NSString) IDCoder.INST.pop(ctx);
    assertEquals(expected, Utils.get().strings().javaString(ret));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:SubclassingTest.java


注:本文中的com.apple.jobjc.Invoke.MsgSend类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。