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


Java MapEntry类代码示例

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


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

示例1: getEntries

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
static <K, V> List<MapEntry> getEntries(Map<K, V> map) {
	if (map.isEmpty())
		return Collections.emptyList();

	List<MapEntry> entries = new ArrayList<MapEntry>(map.size());
	// convert map objects
	for (Map.Entry<K, V> entry : map.entrySet()) {
		NonNullMetadata key = (NonNullMetadata) ValueFactory.buildValue(entry.getKey());
		Metadata value = (Metadata) ValueFactory.buildValue(entry.getValue());

		entries.add(new SimpleMapEntry(key, value));
	}
	return Collections.unmodifiableList(entries);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:ValueFactory.java

示例2: testSimpleBean

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
public void testSimpleBean() throws Exception {
	ServiceMetadata metadata = getReferenceMetadata("simple");
	assertEquals(ServiceMetadata.AUTO_EXPORT_DISABLED, metadata.getAutoExport());
	List<String> intfs = metadata.getInterfaces();
	assertEquals(1, intfs.size());
	assertEquals(Map.class.getName(), intfs.iterator().next());
	assertEquals(123, metadata.getRanking());
	assertTrue(metadata.getRegistrationListeners().isEmpty());

	assertTrue(metadata.getServiceComponent() instanceof RefMetadata);
	List<MapEntry> props = metadata.getServiceProperties();
	System.out.println(props);
	// assertEquals("lip", props.get("fat"));
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:ExporterMetadataTest.java

示例3: testParseServer

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
@Test
public void testParseServer() throws Exception {
    Element root = parseRootElement();
    NodeList nodes = root.getElementsByTagNameNS(NAMESPACE_URI, "server");
    Element element = (Element) nodes.item(0);

    Metadata parsed = handler.parse(element, parserContext);

    assertTrue(parsed instanceof ServiceMetadata);
    ServiceMetadata serviceMetadata = (ServiceMetadata) parsed;
    assertEquals(1, serviceMetadata.getServiceProperties().size());

    final MapEntry entry = serviceMetadata.getServiceProperties().get(0);
    final ValueMetadata key = (ValueMetadata) entry.getKey();
    assertEquals("microbule.server", key.getStringValue());
    assertEquals(String.class.getName(), key.getType());

    final ValueMetadata value = (ValueMetadata) entry.getValue();
    assertEquals("true", value.getStringValue());
    assertEquals(String.class.getName(), value.getType());

    assertEquals(Lists.newArrayList(HelloService.class.getName()), serviceMetadata.getInterfaces());
    final Target target = serviceMetadata.getServiceComponent();
    assertTrue(target instanceof RefMetadata);
    RefMetadata targetRef = (RefMetadata) target;
    assertEquals("helloService", targetRef.getComponentId());
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:28,代码来源:MicrobuleNamespaceHandlerTest.java

示例4: getEntries

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
public List<MapEntry> getEntries() {
	return entries;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:4,代码来源:SimplePropsMetadata.java

示例5: getServiceProperties

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
public List<MapEntry> getServiceProperties() {
	return serviceProperties;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:4,代码来源:SimpleServiceExportComponentMetadata.java

示例6: doExecute

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
@Override
 protected Object doExecute() throws Exception {
 	final Collection<ServiceReference<BlueprintContainer>> services = this.bundleContext.getServiceReferences(BlueprintContainer.class, null);
 	for (final ServiceReference<BlueprintContainer> sr : services) {

 		final List<String> commands = new ArrayList<String>();
 		
 		final BlueprintContainer container = this.bundleContext.getService(sr);
final Collection<ServiceMetadata> metadata = container.getMetadata(ServiceMetadata.class);
 		for (final ServiceMetadata data : metadata) {
 			String scope = null;
 			String function = null;

 			// Implements OSGi API
 			@SuppressWarnings("unchecked")
	final List properties = data.getServiceProperties();
 			for (final Object o : properties) {
 				final MapEntry entry = (MapEntry)o;
 				String key, value;
 				if (entry.getKey() instanceof ValueMetadata) {
 					final ValueMetadata vmKey = (ValueMetadata)entry.getKey();
 					key = vmKey.getStringValue();
 				} else {
 					key = entry.getKey().toString();
 				}
 				if (entry.getValue() instanceof ValueMetadata) {
 					final ValueMetadata vmValue = (ValueMetadata)entry.getValue();
 					value = vmValue.getStringValue();
 				} else {
 					value = entry.getValue().toString();
 				}
 				if (key.equals("osgi.command.scope")) {
 					scope = value;
 				} else if (key.equals("osgi.command.function")) {
 					function = value;
 				}
 			}
 			if (scope != null && function != null) {
 				commands.add(scope + ":" + function);
 			}
 		}
 		
 		if (commands.size() > 0) {
  		System.out.println(sr.getBundle());
  		
 			for (final String command : commands) {
 				System.out.println("    " + command);
 			}
  		
  		System.out.println();
 		}
 	}

 	return null;
 }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:56,代码来源:CommandProviderShellCommand.java

示例7: SimpleMapMetadata

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
/**
 * 
 * Constructs a new <code>SimpleMapMetadata</code> instance.
 * 
 * @param entries
 * @param keyTypeName
 * @param valueTypeName
 */
public SimpleMapMetadata(List<MapEntry> entries, String keyTypeName, String valueTypeName) {
	this.entries = entries;
	this.keyValueType = (StringUtils.hasText(keyTypeName) ? keyTypeName : null);
	this.valueValueType = (StringUtils.hasText(valueTypeName) ? valueTypeName : null);
	;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:SimpleMapMetadata.java

示例8: SimplePropsMetadata

import org.osgi.service.blueprint.reflect.MapEntry; //导入依赖的package包/类
/**
 * Constructs a new <code>SimplePropertiesValue</code> instance.
 * 
 * @param entries
 */
public SimplePropsMetadata(List<MapEntry> entries) {
	this.entries = entries;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:9,代码来源:SimplePropsMetadata.java


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