本文整理汇总了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;
}
示例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;
}
示例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;
}