public static final class OptionMap.Builder extends Object
OptionMap.builder() method.| Modifier and Type | Method and Description |
|---|---|
OptionMap.Builder |
add(Map<?,?> map)
Add all the entries of a map.
|
OptionMap.Builder |
addAll(OptionMap optionMap)
Add all entries from an existing option map to the one being built.
|
OptionMap |
getMap()
Build a map that reflects the current state of this builder.
|
<T> OptionMap.Builder |
parse(Option<T> key,
String stringValue)
Set a key-value pair, parsing the value from the given string.
|
<T> OptionMap.Builder |
parse(Option<T> key,
String stringValue,
ClassLoader classLoader)
Set a key-value pair, parsing the value from the given string.
|
OptionMap.Builder |
parseAll(Properties props,
String prefix)
Add all options from a properties file.
|
OptionMap.Builder |
parseAll(Properties props,
String prefix,
ClassLoader optionClassLoader)
Add all options from a properties file.
|
OptionMap.Builder |
set(Option<Boolean> key,
boolean value)
Set a boolean value for a Boolean key.
|
OptionMap.Builder |
set(Option<Integer> key,
int value)
Set an int value for an Integer key.
|
OptionMap.Builder |
set(Option<Long> key,
long value)
Set a long value for a Long key.
|
<T> OptionMap.Builder |
set(Option<T> key,
T value)
Set a key-value pair.
|
OptionMap.Builder |
setSequence(Option<Sequence<Boolean>> key,
boolean... values)
Set boolean values for an Boolean sequence key.
|
OptionMap.Builder |
setSequence(Option<Sequence<Integer>> key,
int... values)
Set int values for an Integer sequence key.
|
OptionMap.Builder |
setSequence(Option<Sequence<Long>> key,
long... values)
Set long values for a Long sequence key.
|
<T> OptionMap.Builder |
setSequence(Option<Sequence<T>> key,
T... values)
Set a key-value pair, where the value is a sequence type.
|
public <T> OptionMap.Builder parse(Option<T> key, String stringValue)
T - the option typekey - the keystringValue - the string valuepublic <T> OptionMap.Builder parse(Option<T> key, String stringValue, ClassLoader classLoader)
T - the option typekey - the keystringValue - the string valueclassLoader - the class loader to use for parsing the valuepublic OptionMap.Builder parseAll(Properties props, String prefix, ClassLoader optionClassLoader)
If the prefix does not end with '.' character, a '.' will be appended to it before parsing.
props - the properties to readprefix - the prefixoptionClassLoader - the class loader to use to resolve option namespublic OptionMap.Builder parseAll(Properties props, String prefix)
If the prefix does not end with '.' character, a '.' will be appended to it before parsing.
props - the properties to readprefix - the prefixpublic <T> OptionMap.Builder set(Option<T> key, T value)
T - the option typekey - the keyvalue - the valuepublic OptionMap.Builder set(Option<Integer> key, int value)
key - the optionvalue - the valuepublic OptionMap.Builder setSequence(Option<Sequence<Integer>> key, int... values)
key - the keyvalues - the valuespublic OptionMap.Builder set(Option<Long> key, long value)
key - the optionvalue - the valuepublic OptionMap.Builder setSequence(Option<Sequence<Long>> key, long... values)
key - the keyvalues - the valuespublic OptionMap.Builder set(Option<Boolean> key, boolean value)
key - the optionvalue - the valuepublic OptionMap.Builder setSequence(Option<Sequence<Boolean>> key, boolean... values)
key - the keyvalues - the valuespublic <T> OptionMap.Builder setSequence(Option<Sequence<T>> key, T... values)
T - the option typekey - the keyvalues - the valuespublic OptionMap.Builder add(Map<?,?> map) throws ClassCastException
Options, or whose
values are not valid arguments for the given Option, will cause an exception to be thrown.
Any keys which occur more than once in this builder will be overwritten with the last occurring value.map - the mapClassCastException - if any entries of the map are not valid option-value pairspublic OptionMap.Builder addAll(OptionMap optionMap)
optionMap - the original option mappublic OptionMap getMap()
Copyright © 2017 JBoss by Red Hat. All rights reserved.