Top Description Fields Constructors Methods
javax.money

public abstract Class AbstractContextBuilder<B extends javax.money.AbstractContextBuilder, C extends javax.money.AbstractContext>

extends Object
Class Inheritance
Known Direct Subclasses
javax.money.AbstractQueryBuilder, javax.money.CurrencyContextBuilder, javax.money.MonetaryContextBuilder, javax.money.RoundingContextBuilder, javax.money.convert.ConversionContextBuilder, javax.money.convert.ProviderContextBuilder, javax.money.format.AmountFormatContextBuilder
Annotations
@SuppressWarnings:unchecked, rawtypes
Imports
java.util.HashMap, .Map, .Objects, .TreeMap

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, javax.money.MonetaryRounding, javax.money.CurrencyUnit, javax.money.convert.ExchangeRateProvider and .CurrencyConversion.

Instances of this class are not thread-safe and not serializable.

Field Summary

Modifier and TypeField and Description
pack-priv final Map<String, Object>
data

The data map containing all values.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract C

Returns:

a new AbstractContext. never null.
build
()

Creates a new AbstractContext with the data from this Builder instance.

public B

Returns:

this Builder, for chaining
importContext
(AbstractContext
the context to be applied, not null.
context
,
boolean
flag, if existing entries should be overwritten.
overwriteDuplicates
)

Apply all attributes on the given context.

public B

Returns:

this Builder, for chaining
importContext
(AbstractContext
the context to be applied, not null.
context
)

Apply all attributes on the given context, hereby existing entries are preserved.

public B

Returns:

this Builder, for chaining
removeAttributes
(String...
the keys
keys
)

Removes an entry of a certain keys.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
int
the value
value
)

Sets an Integer attribute.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
boolean
the value
value
)

Sets an Boolean attribute.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
long
the value
value
)

Sets an Long attribute.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
float
the value
value
)

Sets an Float attribute.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
double
the value
value
)

Sets an Double attribute.

public B

Returns:

the Builder, for chaining.
set
(String
the key, non null.
key
,
char
the value
value
)

Sets an Character attribute.

public B

Returns:

this Builder, for chaining
set
(Object
the attribute value, not null.
value
)

Sets an attribute, using attribute.getClass() as attribute type and attribute.getClass().getName() as attribute name.

public B

Returns:

this Builder, for chaining
set
(String
the attribute's key, not null
key
,
Object
the attribute value, not null.
value
)

Sets an attribute, using attribute.getClass() as attribute type.

public <T> B

Returns:

this Builder, for chaining
set
(Class<T>
the attribute's key, not null
key
,
T
the attribute value, not null.
value
)

Sets an attribute, using attribute.getClass() as attribute type.

public B

Returns:

the Builder for chaining
setProviderName
(String
the provider, not null.
provider
)

Sets the provider.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

databack to summary
pack-priv final Map<String, Object> data

The data map containing all values.

Constructor Detail

AbstractContextBuilderback to summary
public AbstractContextBuilder()

Method Detail

buildback to summary
public abstract C build()

Creates a new AbstractContext with the data from this Builder instance.

Returns:C

a new AbstractContext. never null.

importContextback to summary
public B importContext(AbstractContext context, boolean overwriteDuplicates)

Apply all attributes on the given context.

Parameters
context:AbstractContext

the context to be applied, not null.

overwriteDuplicates:boolean

flag, if existing entries should be overwritten.

Returns:B

this Builder, for chaining

importContextback to summary
public B importContext(AbstractContext context)

Apply all attributes on the given context, hereby existing entries are preserved.

Parameters
context:AbstractContext

the context to be applied, not null.

Returns:B

this Builder, for chaining

See Also
importContext(AbstractContext, boolean)
removeAttributesback to summary
public B removeAttributes(String... keys)

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 example removeAttributes ("a", "b", "c") removes all attributes named 'a','b' and 'c'.

Parameters
keys:String[]

the keys

Returns:B

this Builder, for chaining

setback to summary
public B set(String key, int value)

Sets an Integer attribute.

Parameters
key:String

the key, non null.

value:int

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(String key, boolean value)

Sets an Boolean attribute.

Parameters
key:String

the key, non null.

value:boolean

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(String key, long value)

Sets an Long attribute.

Parameters
key:String

the key, non null.

value:long

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(String key, float value)

Sets an Float attribute.

Parameters
key:String

the key, non null.

value:float

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(String key, double value)

Sets an Double attribute.

Parameters
key:String

the key, non null.

value:double

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(String key, char value)

Sets an Character attribute.

Parameters
key:String

the key, non null.

value:char

the value

Returns:B

the Builder, for chaining.

setback to summary
public B set(Object value)

Sets an attribute, using attribute.getClass() as attribute type and attribute.getClass().getName() as attribute name.

Parameters
value:Object

the attribute value, not null.

Returns:B

this Builder, for chaining

setback to summary
public B set(String key, Object value)

Sets an attribute, using attribute.getClass() as attribute type.

Parameters
key:String

the attribute's key, not null

value:Object

the attribute value, not null.

Returns:B

this Builder, for chaining

setback to summary
public <T> B set(Class<T> key, T value)

Sets an attribute, using attribute.getClass() as attribute type.

Parameters
key:Class<T>

the attribute's key, not null

value:T

the attribute value, not null.

Returns:B

this Builder, for chaining

setProviderNameback to summary
public B setProviderName(String provider)

Sets the provider.

Parameters
provider:String

the provider, not null.

Returns:B

the Builder for chaining

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override