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


Java RubyModule.defineAnnotatedMethods方法代码示例

本文整理汇总了Java中org.jruby.RubyModule.defineAnnotatedMethods方法的典型用法代码示例。如果您正苦于以下问题:Java RubyModule.defineAnnotatedMethods方法的具体用法?Java RubyModule.defineAnnotatedMethods怎么用?Java RubyModule.defineAnnotatedMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jruby.RubyModule的用法示例。


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

示例1: load

import org.jruby.RubyModule; //导入方法依赖的package包/类
public void load(Ruby runtime, boolean wrap) throws IOException {
    RubyModule jo = runtime.defineModule("Jo");
    final ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactory() {
        public Thread newThread(Runnable r) {
            Thread t = new Thread(r);
            t.setDaemon(true);
            return t;
        }
    });
    jo.setInternalVariable("executor", executor);
    RubyClass joFuture = jo.defineClassUnder("Future", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    RubyClass joChannel = jo.defineClassUnder("Channel", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
    
    jo.defineAnnotatedMethods(JoMethods.class);
    joFuture.defineAnnotatedMethods(JoFuture.class);
    joChannel.defineAnnotatedMethods(JoChannel.class);
    
    runtime.addFinalizer(new Finalizable() {
        public void finalize() {
            executor.shutdown();
        }
    });
}
 
开发者ID:headius,项目名称:jo,代码行数:24,代码来源:JoLibrary.java

示例2: setup

import org.jruby.RubyModule; //导入方法依赖的package包/类
public static void setup(Ruby runtime) {
    RubyModule bindex = runtime.defineModule("Bindex");
    bindex.defineAnnotatedMethods(BindexMethods.class);

    RubyClass exception = runtime.getException();
    exception.defineAnnotatedMethods(ExceptionExtensionMethods.class);

    IRubyObject verbose = runtime.getVerbose();
    try {
        runtime.setVerbose(runtime.getNil());
        runtime.addEventHook(new SetExceptionBindingsEventHook());
    } finally {
        runtime.setVerbose(verbose);
    }
}
 
开发者ID:gsamokovarov,项目名称:bindex,代码行数:16,代码来源:JRubyIntegration.java

示例3: buildModuleFromDescriptor

import org.jruby.RubyModule; //导入方法依赖的package包/类
private RubyModule buildModuleFromDescriptor(ThreadContext context) {
    Ruby runtime = context.runtime;
    Utils.checkNameAvailability(context, name.asJavaString());

    RubyModule enumModule = RubyModule.newModule(runtime);
    for (Descriptors.EnumValueDescriptor value : descriptor.getValues()) {
        enumModule.defineConstant(value.getName(), runtime.newFixnum(value.getNumber()));
    }

    enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
    enumModule.defineAnnotatedMethods(RubyEnum.class);
    return enumModule;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:14,代码来源:RubyEnumDescriptor.java

示例4: createDocuments

import org.jruby.RubyModule; //导入方法依赖的package包/类
private void createDocuments(Ruby ruby, RubyModule xmlModule, RubyModule htmlModule, RubyClass node) {
    RubyClass xmlDocument = xmlModule.defineClassUnder("Document", node, XML_DOCUMENT_ALLOCATOR);
    xmlDocument.defineAnnotatedMethods(XmlDocument.class);
    
    //RubyModule htmlDoc = html.defineOrGetClassUnder("Document", document);
    RubyModule htmlDocument = htmlModule.defineClassUnder("Document", xmlDocument, HTML_DOCUMENT_ALLOCATOR);
    htmlDocument.defineAnnotatedMethods(HtmlDocument.class);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:9,代码来源:NokogiriService.java

示例5: basicLoad

import org.jruby.RubyModule; //导入方法依赖的package包/类
@Override
public boolean basicLoad(Ruby ruby) throws IOException {
    final RubyModule module = ruby.defineModule("Collapstring");
    module.defineAnnotatedMethods(CollapstringService.class);
    return true;
}
 
开发者ID:airbnb,项目名称:collapstring,代码行数:7,代码来源:CollapstringService.java

示例6: createProtobuf

import org.jruby.RubyModule; //导入方法依赖的package包/类
public static void createProtobuf(Ruby runtime) {
    RubyModule mGoogle = runtime.getModule("Google");
    RubyModule mProtobuf = mGoogle.defineModuleUnder("Protobuf");
    mProtobuf.defineAnnotatedMethods(RubyProtobuf.class);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:6,代码来源:RubyProtobuf.java

示例7: createXmlModule

import org.jruby.RubyModule; //导入方法依赖的package包/类
private RubyClass createXmlModule(Ruby ruby, RubyModule xmlModule) {
    RubyClass node = xmlModule.defineClassUnder("Node", ruby.getObject(), XML_NODE_ALLOCATOR);
    node.defineAnnotatedMethods(XmlNode.class);
    
    RubyClass attr = xmlModule.defineClassUnder("Attr", node, XML_ATTR_ALLOCATOR);
    attr.defineAnnotatedMethods(XmlAttr.class);
    
    RubyClass attrDecl = xmlModule.defineClassUnder("AttributeDecl", node, XML_ATTRIBUTE_DECL_ALLOCATOR);
    attrDecl.defineAnnotatedMethods(XmlAttributeDecl.class);
    
    RubyClass characterData = xmlModule.defineClassUnder("CharacterData", node, null);
    
    RubyClass comment = xmlModule.defineClassUnder("Comment", characterData, XML_COMMENT_ALLOCATOR);
    comment.defineAnnotatedMethods(XmlComment.class);
    
    RubyClass text = xmlModule.defineClassUnder("Text", characterData, XML_TEXT_ALLOCATOR);
    text.defineAnnotatedMethods(XmlText.class);
    
    RubyModule cdata = xmlModule.defineClassUnder("CDATA", text, XML_CDATA_ALLOCATOR);
    cdata.defineAnnotatedMethods(XmlCdata.class);
    
    RubyClass dtd = xmlModule.defineClassUnder("DTD", node, XML_DTD_ALLOCATOR);
    dtd.defineAnnotatedMethods(XmlDtd.class);

    RubyClass documentFragment = xmlModule.defineClassUnder("DocumentFragment", node, XML_DOCUMENT_FRAGMENT_ALLOCATOR);
    documentFragment.defineAnnotatedMethods(XmlDocumentFragment.class);
    
    RubyClass element = xmlModule.defineClassUnder("Element", node, XML_ELEMENT_ALLOCATOR);
    element.defineAnnotatedMethods(XmlElement.class);
    
    RubyClass elementContent = xmlModule.defineClassUnder("ElementContent", ruby.getObject(), XML_ELEMENT_CONTENT_ALLOCATOR);
    elementContent.defineAnnotatedMethods(XmlElementContent.class);
    
    RubyClass elementDecl = xmlModule.defineClassUnder("ElementDecl", node, XML_ELEMENT_DECL_ALLOCATOR);
    elementDecl.defineAnnotatedMethods(XmlElementDecl.class);
    
    RubyClass entityDecl = xmlModule.defineClassUnder("EntityDecl", node, XML_ENTITY_DECL_ALLOCATOR);
    entityDecl.defineAnnotatedMethods(XmlEntityDecl.class);
    
    entityDecl.defineConstant("INTERNAL_GENERAL", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_GENERAL));
    entityDecl.defineConstant("EXTERNAL_GENERAL_PARSED", RubyFixnum.newFixnum(ruby, XmlEntityDecl.EXTERNAL_GENERAL_PARSED));
    entityDecl.defineConstant("EXTERNAL_GENERAL_UNPARSED", RubyFixnum.newFixnum(ruby, XmlEntityDecl.EXTERNAL_GENERAL_UNPARSED));
    entityDecl.defineConstant("INTERNAL_PARAMETER", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_PARAMETER));
    entityDecl.defineConstant("EXTERNAL_PARAMETER", RubyFixnum.newFixnum(ruby, XmlEntityDecl.EXTERNAL_PARAMETER));
    entityDecl.defineConstant("INTERNAL_PREDEFINED", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_PREDEFINED));
    
    RubyClass entref = xmlModule.defineClassUnder("EntityReference", node, XML_ENTITY_REFERENCE_ALLOCATOR);
    entref.defineAnnotatedMethods(XmlEntityReference.class);
    
    RubyClass namespace = xmlModule.defineClassUnder("Namespace", ruby.getObject(), XML_NAMESPACE_ALLOCATOR);
    namespace.defineAnnotatedMethods(XmlNamespace.class);
    
    RubyClass nodeSet = xmlModule.defineClassUnder("NodeSet", ruby.getObject(), XML_NODESET_ALLOCATOR);
    nodeSet.defineAnnotatedMethods(XmlNodeSet.class);
    
    RubyClass pi = xmlModule.defineClassUnder("ProcessingInstruction", node, XML_PROCESSING_INSTRUCTION_ALLOCATOR);
    pi.defineAnnotatedMethods(XmlProcessingInstruction.class);
    
    RubyClass reader = xmlModule.defineClassUnder("Reader", ruby.getObject(), XML_READER_ALLOCATOR);
    reader.defineAnnotatedMethods(XmlReader.class);
    
    RubyClass schema = xmlModule.defineClassUnder("Schema", ruby.getObject(), XML_SCHEMA_ALLOCATOR);
    schema.defineAnnotatedMethods(XmlSchema.class);

    RubyClass relaxng = xmlModule.defineClassUnder("RelaxNG", schema, XML_RELAXNG_ALLOCATOR);
    relaxng.defineAnnotatedMethods(XmlRelaxng.class);
    
    RubyClass xpathContext = xmlModule.defineClassUnder("XPathContext", ruby.getObject(), XML_XPATHCONTEXT_ALLOCATOR);
    xpathContext.defineAnnotatedMethods(XmlXpathContext.class);
    
    return node;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:73,代码来源:NokogiriService.java


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