public abstract class AbstractContext extends Object implements Serializable
Q
. Contexts are used to add arbitrary
data that cannot be be mapped in a standard way to the money API, e.g. use case or customer specific
extensions os specialities.Superclasses of this class must be final, immutable, serializable and thread-safe.
Modifier and Type | Field and Description |
---|---|
protected static String |
KEY_PROVIDER
Key for storing the target providers to be queried
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractContext(AbstractContextBuilder<?,?> builder)
Private constructor, used by
AbstractContextBuilder . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
<T> T |
get(Class<T> type)
Access an attribute, hereby using the class name as key.
|
<T> T |
get(String key,
Class<T> type)
Access an attribute.
|
Boolean |
getBoolean(String key)
Access a Boolean attribute.
|
Double |
getDouble(String key)
Access a Double attribute.
|
Float |
getFloat(String key)
Access a Float attribute.
|
Integer |
getInt(String key)
Access an Integer attribute.
|
Set<String> |
getKeys(Class<?> type)
Get the present keys of all entries with a given type, checking hereby if assignable.
|
Long |
getLong(String key)
Access a Long attribute.
|
String |
getProviderName()
Get the provider name of this context.
|
String |
getText(String key)
Access a String attribute.
|
Class<?> |
getType(String key)
Get the current attribute type.
|
int |
hashCode() |
boolean |
isEmpty()
Checks if the current instance has no attributes set.
|
String |
toString() |
protected static final String KEY_PROVIDER
protected AbstractContext(AbstractContextBuilder<?,?> builder)
AbstractContextBuilder
.builder
- the Builder.public Set<String> getKeys(Class<?> type)
type
- The attribute type, not null.public Class<?> getType(String key)
key
- the entry's key, not nullpublic <T> T get(String key, Class<T> type)
type
- the attribute's type, not null
key
- the attribute's key, not null
null
.public <T> T get(Class<T> type)
type
- the type, not null
null
.public Long getLong(String key)
key
- the attribute's key, not null.public Float getFloat(String key)
key
- the attribute's key, not null.public Integer getInt(String key)
key
- the attribute's key, not null.public Boolean getBoolean(String key)
key
- the attribute's key, not null.public Double getDouble(String key)
key
- the attribute's key, not null.public String getText(String key)
key
- the attribute's key, not null.public String getProviderName()
public boolean isEmpty()
Copyright © 2012–2016 JSR 354 - Expert Group. All rights reserved.