@Public @ThreadSafe public class Options extends Object implements Serializable
Constructor and Description |
---|
Options()
Creates a new empty configuration.
|
Options(Map<String,String> map)
Creates a new configuration that is initialized with the options of the given map.
|
Options(Map<String,String> map1,
Map<String,String> map2)
Creates a new configuration that is initialized with the options of the given two maps.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllToProperties(Properties props)
Adds all entries in these options to the given
Properties . |
boolean |
contains(ConfigOption<?> configOption)
Checks whether there is an entry for the given config option.
|
boolean |
containsKey(String key) |
boolean |
equals(Object o) |
static Options |
fromMap(Map<String,String> map) |
<T> T |
get(ConfigOption<T> option) |
String |
get(String key) |
boolean |
getBoolean(String key,
boolean defaultValue) |
double |
getDouble(String key,
double defaultValue) |
int |
getInteger(String key,
int defaultValue) |
long |
getLong(String key,
long defaultValue) |
<T> Optional<T> |
getOptional(ConfigOption<T> option) |
String |
getString(ConfigOption<String> option) |
String |
getString(String key,
String defaultValue) |
int |
hashCode() |
Set<String> |
keySet() |
void |
remove(ConfigOption<?> option) |
void |
remove(String key) |
Options |
removePrefix(String prefix) |
<T> Options |
set(ConfigOption<T> option,
T value) |
void |
set(String key,
String value) |
void |
setInteger(String key,
int value) |
void |
setString(String key,
String value)
Adds the given key/value pair to the configuration object.
|
Map<String,String> |
toMap() |
public Options()
public Options(Map<String,String> map)
public void setString(String key, String value)
key
- the key of the key/value pair to be addedvalue
- the value of the key/value pair to be addedpublic <T> Options set(ConfigOption<T> option, T value)
public <T> T get(ConfigOption<T> option)
public <T> Optional<T> getOptional(ConfigOption<T> option)
public boolean contains(ConfigOption<?> configOption)
configOption
- The configuration optionpublic void remove(String key)
public void remove(ConfigOption<?> option)
public boolean containsKey(String key)
public void addAllToProperties(Properties props)
Properties
.public String getString(ConfigOption<String> option)
public boolean getBoolean(String key, boolean defaultValue)
public int getInteger(String key, int defaultValue)
public double getDouble(String key, double defaultValue)
public void setInteger(String key, int value)
public long getLong(String key, long defaultValue)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.