public final class ConstrainedMap.Transaction extends Object
Note that Transaction
is not thread-safe and should be
used in a single thread.
Modifier and Type | Method and Description |
---|---|
void |
commit(boolean invalid)
Completes the transaction.
|
String |
getLocalizedValue(String key)
Returns localized string representation of snapshot value to which
the specified key is mapped.
|
Map<String,String> |
getLocalizedValues()
Returns localized string representations of this snapshot values.
|
String |
getRawValue(String key)
Returns default string representation of snapshot value to which the
specified key is mapped.
|
Map<String,String> |
getRawValues()
Returns default string representations of this snapshot values.
|
<V> V |
getValue(String key)
Returns snapshot value to which the specified key is mapped.
|
void |
resetValue(String key)
Resets snapshot value of the specified key to its default value.
|
void |
resetValues()
Resets all the values of this snapshot to its default values.
|
void |
rollback()
Rolls back the transaction.
|
void |
setLocalizedValue(String key,
String value)
Assigns the specified value for the specified key in this snapshot.
|
void |
setLocalizedValues(Map<String,String> values)
Assigns the specified map values to this snapshot.
|
void |
setRawValue(String key,
String value)
Assigns the specified value for the specified key in this snapshot.
|
void |
setRawValues(Map<String,String> values)
Assigns the specified map values to this snapshot.
|
void |
setValue(String key,
Object value)
Assigns the specified value for the specified key in this snapshot.
|
void |
setValues(Map<String,Object> values)
Assigns the specified map values to this snapshot.
|
public <V> V getValue(String key)
V
- The value type.key
- Key whose associated value to be returned.IllegalArgumentException
- if this map contains no entry for
the specified key.public void setValue(String key, Object value)
key
- Key for which the specified value to be assigned.value
- Value to be assigned for the specified key.IllegalArgumentException
- if this map contains no entry for
the specified key.public String getRawValue(String key)
key
- Key whose associated default string representation of
value to be returned.IllegalArgumentException
- if this map contains no entry for
the specified key.public void setRawValue(String key, String value)
key
- Key for which the specified value to be assigned.value
- Default string representation of value to be assigned
for the specified key.IllegalArgumentException
- if this map contains no entry for
the specified key.public String getLocalizedValue(String key)
key
- Key whose associated localized string representation of
value to be returned.IllegalArgumentException
- if this map contains no entry for
the specified key.public void setLocalizedValue(String key, String value)
key
- Key for which the specified value to be assigned.value
- Localized string representation of value to be assigned
for the specified key.IllegalArgumentException
- if this map contains no entry for
the specified key.public void resetValue(String key)
key
- Key for which the specified value to be reseted.IllegalArgumentException
- if this map contains no entry for
the specified key.public void setValues(Map<String,Object> values)
values
- Values to be stored in this snapshot.public Map<String,String> getRawValues()
public void setRawValues(Map<String,String> values)
values
- Default string representations of values to be stored
in this snapshot.public Map<String,String> getLocalizedValues()
public void setLocalizedValues(Map<String,String> values)
values
- Localized string representations of values to be
stored in this snapshot.public void resetValues()
public void commit(boolean invalid)
invalid
- Determines if this transaction should be committed
anyway (even with invalid values).ViolationException
- if this snapshot contains invalid values.public void rollback()
Copyright © 2011–2020 FoxLabs. All rights reserved.