public abstract class AbstractContextBuilder<B extends AbstractContextBuilder,C extends AbstractContext> extends Object
MonetaryAmountFactory,
MonetaryRounding,
CurrencyUnit, ExchangeRateProvider and .CurrencyConversion.
Instances of this class are not thread-safe and not serializable.
| Constructor and Description |
|---|
AbstractContextBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract C |
build()
Creates a new
AbstractContext with the data from this Builder
instance. |
B |
importContext(AbstractContext context)
Apply all attributes on the given context, hereby existing entries are preserved.
|
B |
importContext(AbstractContext context,
boolean overwriteDuplicates)
Apply all attributes on the given context.
|
B |
removeAttributes(String... keys)
Removes an entry of a certain keys.
|
<T> B |
set(Class<T> key,
T value)
Sets an attribute, using
attribute.getClass() as attribute
type. |
B |
set(Object value)
Sets an attribute, using
attribute.getClass() as attribute
type and attribute.getClass().getName() as attribute
name. |
B |
set(String key,
boolean value)
Sets an Boolean attribute.
|
B |
set(String key,
char value)
Sets an Character attribute.
|
B |
set(String key,
double value)
Sets an Double attribute.
|
B |
set(String key,
float value)
Sets an Float attribute.
|
B |
set(String key,
int value)
Sets an Integer attribute.
|
B |
set(String key,
long value)
Sets an Long attribute.
|
B |
set(String key,
Object value)
Sets an attribute, using
attribute.getClass() as attribute
type. |
B |
setProviderName(String provider)
Sets the provider.
|
String |
toString() |
public B importContext(AbstractContext context, boolean overwriteDuplicates)
context - the context to be applied, not null.overwriteDuplicates - flag, if existing entries should be overwritten.public B importContext(AbstractContext context)
context - the context to be applied, not null.importContext(AbstractContext, boolean)public B set(String key, int value)
key - the key, non null.value - the valuepublic B set(String key, boolean value)
key - the key, non null.value - the valuepublic B set(String key, long value)
key - the key, non null.value - the valuepublic B set(String key, float value)
key - the key, non null.value - the valuepublic B set(String key, double value)
key - the key, non null.value - the valuepublic B set(String key, char value)
key - the key, non null.value - the valuepublic B set(Object value)
attribute.getClass() as attribute
type and attribute.getClass().getName() as attribute
name.value - the attribute valuepublic B set(String key, Object value)
attribute.getClass() as attribute
type.value - the attribute valuekey - the attribute's key, not nullpublic <T> B set(Class<T> key, T value)
attribute.getClass() as attribute
type.value - the attribute valuekey - the attribute's key, not nullpublic B setProviderName(String provider)
provider - the provider, not null.public B removeAttributes(String... keys)
removeAttributes
("a", "b", "c") removes all attributes named 'a','b' and 'c'.keys - the keyspublic abstract C build()
AbstractContext with the data from this Builder
instance.AbstractContext. never null.Copyright © 2012–2016 JSR 354 - Expert Group. All rights reserved.