Package org.jruby

Examples of org.jruby.RubyClass.defineAnnotatedConstants()


    public static RubyClass createCallbackInfoClass(Ruby runtime, RubyModule module) {
        RubyClass result = module.defineClassUnder(CLASS_NAME,
                module.getClass("Type"),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(CallbackInfo.class);
        result.defineAnnotatedConstants(CallbackInfo.class);

        module.getClass("Type").setConstant("Function", result);
        return result;
    }
   
View Full Code Here


    public static RubyClass createAbstractInvokerClass(Ruby runtime, RubyModule module) {
        RubyClass result = module.defineClassUnder(CLASS_NAME,
                module.getClass("Pointer"),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(AbstractInvoker.class);
        result.defineAnnotatedConstants(AbstractInvoker.class);

        return result;
    }
   
    /**
 
View Full Code Here

        RubyClass result = module.defineClassUnder("Invoker",
                module.getClass("AbstractInvoker"),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(AbstractInvoker.class);
        result.defineAnnotatedMethods(JFFIInvoker.class);
        result.defineAnnotatedConstants(JFFIInvoker.class);

        return result;
    }

    JFFIInvoker(Ruby runtime, long address, Type returnType, Type[] parameterTypes, CallingConvention convention) {
View Full Code Here

    public static RubyClass createEnumClass(Ruby runtime, RubyModule ffiModule) {
        RubyClass enumClass = ffiModule.defineClassUnder("Enum", runtime.getObject(),
                Allocator.INSTANCE);
        enumClass.defineAnnotatedMethods(Enum.class);
        enumClass.defineAnnotatedConstants(Enum.class);
        enumClass.includeModule(ffiModule.getConstant("DataConverter"));
       
        return enumClass;
    }
View Full Code Here

       
    public static RubyClass createEnumsClass(Ruby runtime, RubyModule ffiModule) {
        RubyClass enumsClass = ffiModule.defineClassUnder("Enums", runtime.getObject(),
                Allocator.INSTANCE);
        enumsClass.defineAnnotatedMethods(Enums.class);
        enumsClass.defineAnnotatedConstants(Enums.class);
        enumsClass.includeModule(ffiModule.getConstant("DataConverter"));

        return enumsClass;
    }
View Full Code Here

    public static RubyClass createAutoPointerClass(Ruby runtime, RubyModule module) {
        RubyClass autoptrClass = module.defineClassUnder(AUTOPTR_CLASS_NAME,
                module.getClass("Pointer"),
                RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(AutoPointer.class) : AutoPointerAllocator.INSTANCE);
        autoptrClass.defineAnnotatedMethods(AutoPointer.class);
        autoptrClass.defineAnnotatedConstants(AutoPointer.class);
        autoptrClass.setReifiedClass(AutoPointer.class);
        autoptrClass.kindOf = new RubyModule.KindOf() {
            @Override
            public boolean isKindOf(IRubyObject obj, RubyModule type) {
                return obj instanceof AutoPointer && super.isKindOf(obj, type);
View Full Code Here

    public static RubyClass createStructByValueClass(Ruby runtime, RubyModule ffiModule) {
        RubyClass sbvClass = ffiModule.defineClassUnder("StructByValue", ffiModule.getClass("Type"),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        sbvClass.defineAnnotatedMethods(StructByValue.class);
        sbvClass.defineAnnotatedConstants(StructByValue.class);

        ffiModule.getClass("Type").setConstant("Struct", sbvClass);

        return sbvClass;
    }
View Full Code Here

    public static RubyClass createTypeClass(Ruby runtime, RubyModule ffiModule) {
        RubyClass typeClass = ffiModule.defineClassUnder("Type", runtime.getObject(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        typeClass.defineAnnotatedMethods(Type.class);
        typeClass.defineAnnotatedConstants(Type.class);

        RubyClass builtinClass = typeClass.defineClassUnder("Builtin", typeClass,
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        builtinClass.defineAnnotatedMethods(Builtin.class);
       
View Full Code Here

    public static RubyClass createBufferClass(Ruby runtime, RubyModule module) {
        RubyClass result = module.defineClassUnder("Buffer",
                module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
                BufferAllocator.INSTANCE);
        result.defineAnnotatedMethods(Buffer.class);
        result.defineAnnotatedConstants(Buffer.class);

        return result;
    }

    private static final class BufferAllocator implements ObjectAllocator {
View Full Code Here

    public static RubyClass createFileDescriptorIOClass(Ruby runtime, RubyModule module) {
        RubyClass result = runtime.defineClassUnder(CLASS_NAME, runtime.getClass("IO"),
                Allocator.INSTANCE, module);
        result.defineAnnotatedMethods(FileDescriptorIO.class);
        result.defineAnnotatedConstants(FileDescriptorIO.class);

        return result;
    }

    @JRubyMethod(name = "new", meta = true)
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.