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


Java Configuration.getProperties方法代码示例

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


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

示例1: getStringExtends

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
/**
 * <p>getStringExtends.</p>
 *
 * @param config a {@link javax.ws.rs.core.Configuration} object.
 * @param module a {@link java.lang.String} object.
 * @return a {@link java.lang.String} object.
 */
public static String getStringExtends(Configuration config, String module) {
    Map<String, Object> map = config.getProperties();
    String extension = (String) map.get(AbstractTemplateProcessor.TEMPLATE_CONF_PREFIX + module + ".suffix");
    if (StringUtils.isNotBlank(extension)) {
        extension = StringUtils.deleteWhitespace(extension);
    }

    if (StringUtils.isBlank(extension)) {
        extension = (String) map.get(AbstractTemplateProcessor.TEMPLATE_CONF_PREFIX + "suffix");
        if (StringUtils.isNotBlank(extension)) {
            extension = StringUtils.deleteWhitespace(extension);
        }
    }

    return StringUtils.isBlank(extension) ? null : extension.toLowerCase();
}
 
开发者ID:icode,项目名称:ameba,代码行数:24,代码来源:TemplateHelper.java

示例2: testConfiguration

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
@Test
public void testConfiguration() throws Exception {
	logger.info("start REST Configuration test");
	Client client = newClient();
	Configuration configuration = client.getConfiguration();
	Set<Class<?>> classes = configuration.getClasses();
	for (Class<?> clazz : classes) {
		assertTrue("verify if the class is a rest component or provider",
				MessageBodyReader.class.isAssignableFrom(clazz) || MessageBodyWriter.class.isAssignableFrom(clazz)
						|| clazz.isAnnotationPresent(Provider.class)
						|| DynamicFeature.class.isAssignableFrom(clazz));
		Map<Class<?>, Integer> contracts = configuration.getContracts(clazz);
		assertFalse("each class has different contracts", contracts.isEmpty());
		for (Class<?> contract : contracts.keySet()) {
			int value = contracts.get(contract);
			assertTrue("verify if the contract is a rest component or provider",
					value == 5000 || value == 4000 || value == 3000 || value == 0);
		}
	}
	Set<Object> instances = configuration.getInstances();
	assertTrue("by default there are not instances", instances.isEmpty());
	Map<String, Object> properties = configuration.getProperties();
	assertTrue("by default there are not properties", properties.isEmpty());
	MyComponent myComponent = new MyComponent();
	client.register(myComponent);
	instances = configuration.getInstances();
	assertFalse("Added instance", instances.isEmpty());
	for (Object instance : instances) {
		if (instance instanceof MyComponent)
			assertTrue("MyComponent is registered and active", configuration.isEnabled((Feature) instance));
	}
	assertEquals("Added property through MyComponent", 1, properties.size());
	boolean property = (Boolean) properties.get("configured_myComponent");
	assertEquals("configured_myComponent ok!", true, property);
	assertEquals("type CLIENT by default", CLIENT, configuration.getRuntimeType());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:37,代码来源:ComponentTestCase.java

示例3: ConfigurationPropertiesProvider

import javax.ws.rs.core.Configuration; //导入方法依赖的package包/类
public ConfigurationPropertiesProvider(Configuration configuration) {
    Map<String, Object> configProperties = configuration.getProperties();
    propertiesMap = convertToAcceptStringAndPrimitives(configProperties);
}
 
开发者ID:psamsotha,项目名称:jersey-properties,代码行数:5,代码来源:ConfigurationPropertiesProvider.java


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