本文整理了Java中java.util.Properties.getOrDefault()
方法的一些代码示例,展示了Properties.getOrDefault()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.getOrDefault()
方法的具体详情如下:
包路径:java.util.Properties
类名称:Properties
方法名:getOrDefault
暂无
代码示例来源:origin: apache/hive
@Override
public synchronized Object getOrDefault(Object key, Object defaultValue) {
if (interned != null) return interned.getOrDefault(key, defaultValue);
else return super.getOrDefault(key, defaultValue);
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getPulsarImage() {
return (String) properties.getOrDefault("pulsar.container.image", "apachepulsar/pulsar");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getSocatContainerImage() {
return (String) properties.getOrDefault("socat.container.image", "alpine/socat:latest");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getSSHdImage() {
return (String) properties.getOrDefault("sshd.container.image", "quay.io/testcontainers/sshd@sha256:18aa929c653284189fc9cefa45b731021857b6047a0a1757e909f958f258f088");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getKafkaImage() {
return (String) properties.getOrDefault("kafka.container.image", "confluentinc/cp-kafka");
}
代码示例来源:origin: DozerMapper/dozer
/**
* {@inheritDoc}
*/
@Override
public Object get(String key, Object defaultValue) {
return properties.getOrDefault(key, defaultValue);
}
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getAmbassadorContainerImage() {
return (String) properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getTinyImage() {
return (String) properties.getOrDefault("tinyimage.container.image", "alpine:3.5");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getDockerComposeContainerImage() {
return (String) properties.getOrDefault("compose.container.image", "docker/compose:1.8.0");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getRyukImage() {
return (String) properties.getOrDefault("ryuk.container.image", "quay.io/testcontainers/ryuk:0.2.2");
}
代码示例来源:origin: testcontainers/testcontainers-java
public String getVncRecordedContainerImage() {
return (String) properties.getOrDefault("vncrecorder.container.image", "quay.io/testcontainers/vnc-recorder:1.1.0");
}
代码示例来源:origin: Graylog2/graylog2-server
public PluginProperties(Properties properties) {
this.isolated = Boolean.parseBoolean((String) properties.getOrDefault(PROPERTY_ISOLATED, PROPERTY_ISOLATED_DEFAULT));
}
代码示例来源:origin: testcontainers/testcontainers-java
public Integer getRyukTimeout() {
return Integer.parseInt((String) properties.getOrDefault("ryuk.container.timeout", "30"));
}
代码示例来源:origin: testcontainers/testcontainers-java
public boolean isRyukPrivileged() {
return Boolean.parseBoolean((String) properties.getOrDefault("ryuk.container.privileged", "false"));
}
代码示例来源:origin: testcontainers/testcontainers-java
public boolean isDisableChecks() {
return Boolean.parseBoolean((String) properties.getOrDefault("checks.disable", "false"));
}
代码示例来源:origin: jooby-project/jooby
props.getOrDefault("maximumPoolSize", defaultPoolSize.toString()).toString());
代码示例来源:origin: debezium/debezium
/**
* Get a copy of the complete configuration that is or will be used by the running server.
*
* @return the properties for the currently-running server; may be empty if not running
*/
public Properties config() {
Properties runningConfig = new Properties();
runningConfig.putAll(config);
runningConfig.setProperty(KafkaConfig.ZkConnectProp(), zookeeperConnection());
runningConfig.setProperty(KafkaConfig.BrokerIdProp(), Integer.toString(brokerId));
runningConfig.setProperty(KafkaConfig.HostNameProp(), "localhost");
runningConfig.setProperty(KafkaConfig.AutoCreateTopicsEnableProp(), String.valueOf(config.getOrDefault(KafkaConfig.AutoCreateTopicsEnableProp(), Boolean.TRUE)));
// 1 partition for the __consumer_offsets_ topic should be enough
runningConfig.setProperty(KafkaConfig.OffsetsTopicPartitionsProp(), Integer.toString(1));
// Disable delay during every re-balance
runningConfig.setProperty(KafkaConfig.GroupInitialRebalanceDelayMsProp(), Integer.toString(0));
return runningConfig;
}
代码示例来源:origin: apache/metron
/**
* Returns the configuration value, cast to the expected type, from a map of configuration values.
* If the value is not specified, the default value is returned.
*
* @param properties Configuration properties.
* @param defaultValue The default value to return, if one is not defined.
* @param clazz The class of the expected type of the configuration value.
* @param <T> The expected type of the configuration value.
* @return The configuration value or the specified default, if one is not defined.
*/
private <T> T getOrDefault(Properties properties, Object defaultValue, Class<T> clazz) {
Object value = properties.getOrDefault(key, defaultValue);
return value == null ? null : ConversionUtils.convert(value, clazz);
}
代码示例来源:origin: mulesoft/mule
/**
* Initializes the artifact by taking into account deployment properties
* {@link org.mule.runtime.core.api.config.MuleDeploymentProperties#MULE_LAZY_INIT_DEPLOYMENT_PROPERTY}
* and {@link org.mule.runtime.core.api.config.MuleDeploymentProperties#MULE_LAZY_INIT_ENABLE_XML_VALIDATIONS_DEPLOYMENT_PROPERTY}.
*
* @param artifact the T artifact to be initialized
*/
private void doInit(T artifact) {
boolean lazyInit = false;
boolean enableXmlValidations = false;
if (artifact.getDescriptor().getDeploymentProperties().isPresent()) {
Properties deploymentProperties = artifact.getDescriptor().getDeploymentProperties().get();
lazyInit = valueOf((String) deploymentProperties.getOrDefault(MULE_LAZY_INIT_DEPLOYMENT_PROPERTY, "false"));
enableXmlValidations = valueOf((String) deploymentProperties.getOrDefault(
MULE_LAZY_INIT_ENABLE_XML_VALIDATIONS_DEPLOYMENT_PROPERTY,
"false"));
}
if (lazyInit) {
artifact.lazyInit(!enableXmlValidations);
} else {
artifact.init();
}
}
代码示例来源:origin: com.github.dozermapper/dozer-core
/**
* {@inheritDoc}
*/
@Override
public Object get(String key, Object defaultValue) {
return properties.getOrDefault(key, defaultValue);
}
}
内容来源于网络,如有侵权,请联系作者删除!