Class AbstractContextBuilder<B extends AbstractContextBuilder, C extends AbstractContext>
java.lang.Object
javax.money.AbstractContextBuilder<B,C>
- Direct Known Subclasses:
AbstractQueryBuilder, AmountFormatContextBuilder, ConversionContextBuilder, CurrencyContextBuilder, MonetaryContextBuilder, ProviderContextBuilder, RoundingContextBuilder
public abstract class AbstractContextBuilder<B extends AbstractContextBuilder, C extends AbstractContext>
extends Object
This interface defines the common generic parts of a query. Queries are used to pass complex parameters sets
to lookup monetary artifacts, e.g.
MonetaryAmountFactory,
MonetaryRounding,
CurrencyUnit, ExchangeRateProvider and .CurrencyConversion.
Instances of this class are not thread-safe and not serializable.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Cbuild()Creates a newAbstractContextwith the data from this Builder instance.importContext(AbstractContext context) Apply all attributes on the given context, hereby existing entries are preserved.importContext(AbstractContext context, boolean overwriteDuplicates) Apply all attributes on the given context.removeAttributes(String... keys) Removes an entry of a certain keys.<T> BSets an attribute, usingattribute.getClass()as attribute type.Sets an attribute, usingattribute.getClass()as attribute type andattribute.getClass().getName()as attribute name.Sets an Boolean attribute.Sets an Character attribute.Sets an Double attribute.Sets an Float attribute.Sets an Integer attribute.Sets an Long attribute.Sets an attribute, usingattribute.getClass()as attribute type.setProviderName(String provider) Sets the provider.toString()
-
Field Details
-
data
-
-
Constructor Details
-
AbstractContextBuilder
public AbstractContextBuilder()
-
-
Method Details
-
importContext
Apply all attributes on the given context.- Parameters:
context- the context to be applied, not null.overwriteDuplicates- flag, if existing entries should be overwritten.- Returns:
- this Builder, for chaining
-
importContext
Apply all attributes on the given context, hereby existing entries are preserved.- Parameters:
context- the context to be applied, not null.- Returns:
- this Builder, for chaining
- See Also:
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
setProviderName
-
removeAttributes
Removes an entry of a certain keys. This can be useful, when a context is initialized with another existing context, but only subset of the entries should be visible. For exampleremoveAttributes ("a", "b", "c")removes all attributes named 'a','b' and 'c'.- Parameters:
keys- the keys- Returns:
- this Builder, for chaining
-
build
Creates a newAbstractContextwith the data from this Builder instance.- Returns:
- a new
AbstractContext. nevernull.
-
toString
-