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


Java MutableBeanMetadata.setScope方法代码示例

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


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

示例1: createBeanMetadata

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
private static MutableBeanMetadata createBeanMetadata(final ParserContext context, final String id,
        final Class<?> runtimeClass, final boolean initMethod, final boolean destroyMethod) {
    MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
    metadata.setId(id);
    metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
    metadata.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
    metadata.setRuntimeClass(runtimeClass);

    if (initMethod) {
        metadata.setInitMethod("init");
    }

    if (destroyMethod) {
        metadata.setDestroyMethod("destroy");
    }

    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:OpendaylightNamespaceHandler.java

示例2: createBeanMetadata

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
public MutableBeanMetadata createBeanMetadata(Element element, ParserContext context, Class<?> runtimeClass) {
    MutableBeanMetadata answer = context.createMetadata(MutableBeanMetadata.class);
    answer.setRuntimeClass(runtimeClass);
    answer.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
    answer.addProperty("bundleContext", createRef(context, "blueprintBundleContext"));
    // set the Bean scope to be prototype, so we can get a new instance per looking up
    answer.setScope(BeanMetadata.SCOPE_PROTOTYPE);
    
    if (!StringUtils.isEmpty(getIdOrName(element))) {
        answer.setId(getIdOrName(element));
    } else {
        // TODO we may need to throw exception for it
        answer.setId("camel.cxf.endpoint." + runtimeClass.getSimpleName() + "." + context.generateId());
    }
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:AbstractBeanDefinitionParser.java

示例3: parse

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
public Metadata parse(Element element, ParserContext context, Class<?> runtime) {
    MutableBeanMetadata config = createBeanMetadata(element, context, runtime);
    config.setScope(BeanMetadata.SCOPE_PROTOTYPE);
    String camelContextId = "camelContext";
    NamedNodeMap atts = element.getAttributes();
    for (int i = 0; i < atts.getLength(); i++) {
        Attr node = (Attr) atts.item(i);
        String val = node.getValue();
        //String pre = node.getPrefix();
        String name = node.getLocalName();
        if ("camelContextId".equals(name)) {
            camelContextId = val;
        }
    }
    config.addDependsOn(camelContextId);
    config.addProperty("camelContext", createRef(context, camelContextId));
    return config;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:AbstractBeanDefinitionParser.java


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