net.roboconf.core.utils.Utils.getValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中net.roboconf.core.utils.Utils.getValue()方法的一些代码示例,展示了Utils.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getValue()方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:getValue

Utils.getValue介绍

[英]Returns the value contained in a map of string if it exists using the key.
[中]返回字符串映射中包含的值(如果使用键存在)。

代码示例

代码示例来源:origin: net.roboconf/roboconf-messaging-rabbitmq

KeyStore ks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_KEY_STORE_TYPE, DEFAULT_SSL_KEY_STORE_TYPE ));
ks.load( clientIS, keyStorePassphrase );
String value = getValue( configuration, RABBITMQ_SSL_KEY_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY );
KeyManagerFactory kmf = KeyManagerFactory.getInstance( value );
kmf.init( ks, keyStorePassphrase );
KeyStore tks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_TRUST_STORE_TYPE, DEFAULT_SSL_TRUST_STORE_TYPE ));
tks.load( storeIS, trustStorePassphrase );
value = getValue( configuration, RABBITMQ_SSL_TRUST_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY );
TrustManagerFactory tmf = TrustManagerFactory.getInstance( value );
tmf.init( tks );
SSLContext c = SSLContext.getInstance( getValue( configuration, RABBITMQ_SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL ));
c.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null );
factory.useSslProtocol( c );

代码示例来源:origin: roboconf/roboconf-platform

@Test
public void testGetValue() throws Exception {
  Map<String,String> map = new HashMap<>();
  for(int i=0;i<10;i++) {
    map.put(""+i, "toto"+i);
  }
  Assert.assertEquals(10, map.size());
  for(int i=0;i<10;i++) {
    Assert.assertEquals("toto"+i, Utils.getValue(map, ""+i, "tata"));
  }
  Assert.assertEquals("tata", Utils.getValue(map, "coucou", "tata"));
}

相关文章