|
XNIO API 3.0.4.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnio.OptionMap.Builder
public static final class OptionMap.Builder
A builder for immutable option maps. Create an instance with the OptionMap.builder()
method.
Method Summary | ||
---|---|---|
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. |
|
|
parse(Option<T> key,
String stringValue)
Set a key-value pair, parsing the value from the given string. |
|
|
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. |
|
|
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. |
|
|
setSequence(Option<Sequence<T>> key,
T... values)
Set a key-value pair, where the value is a sequence type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public <T> OptionMap.Builder parse(Option<T> key, String stringValue)
T
- the option typekey
- the keystringValue
- the string value
public <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 value
public OptionMap.Builder parseAll(Properties props, String prefix, ClassLoader optionClassLoader)
props
- the properties to readprefix
- the prefixoptionClassLoader
- the class loader to use to resolve option names
public OptionMap.Builder parseAll(Properties props, String prefix)
props
- the properties to readprefix
- the prefix
public <T> OptionMap.Builder set(Option<T> key, T value)
T
- the option typekey
- the keyvalue
- the value
public OptionMap.Builder set(Option<Integer> key, int value)
key
- the optionvalue
- the value
public OptionMap.Builder setSequence(Option<Sequence<Integer>> key, int... values)
key
- the keyvalues
- the values
public OptionMap.Builder set(Option<Long> key, long value)
key
- the optionvalue
- the value
public OptionMap.Builder setSequence(Option<Sequence<Long>> key, long... values)
key
- the keyvalues
- the values
public OptionMap.Builder set(Option<Boolean> key, boolean value)
key
- the optionvalue
- the value
public OptionMap.Builder setSequence(Option<Sequence<Boolean>> key, boolean... values)
key
- the keyvalues
- the values
public <T> OptionMap.Builder setSequence(Option<Sequence<T>> key, T... values)
T
- the option typekey
- the keyvalues
- the values
public OptionMap.Builder add(Map<?,?> map) throws ClassCastException
Option
s, 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 map
ClassCastException
- if any entries of the map are not valid option-value pairspublic OptionMap.Builder addAll(OptionMap optionMap)
optionMap
- the original option map
public OptionMap getMap()
|
XNIO API 3.0.4.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |