當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。