|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.support.transaction.TransactionAwareProxyFactory<T>
public class TransactionAwareProxyFactory<T>
Factory for transaction aware objects (like lists, sets, maps). If a
transaction is active when a method is called on an instance created by the
factory, it makes a copy of the target object and carries out all operations
on the copy. Only when the transaction commits is the target re-initialised
with the copy.
Works well with collections and maps for testing transactional behaviour
without needing a database. The base implementation handles lists, sets and
maps. Subclasses can implement begin(Object) and
commit(Object, Object) to provide support for other resources.
Not intended for multi-threaded use.
| Method Summary | ||
|---|---|---|
protected T |
begin(T target)
Make a copy of the target that can be used inside a transaction to isolate changes from the original. |
|
protected void |
commit(T copy,
T target)
Take the working copy state and commit it back to the original target. |
|
static
|
createTransactionalList()
|
|
static
|
createTransactionalList(java.util.List<T> list)
|
|
static
|
createTransactionalMap()
|
|
static
|
createTransactionalMap(java.util.Map<K,V> map)
|
|
static
|
createTransactionalSet()
|
|
static
|
createTransactionalSet(java.util.Set<T> set)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
protected final T begin(T target)
target - the target object (List, Set or Map)
protected void commit(T copy,
T target)
copy - the working copy.target - the original target of the factory.public static <K,V> java.util.Map<K,V> createTransactionalMap()
public static <K,V> java.util.Map<K,V> createTransactionalMap(java.util.Map<K,V> map)
public static <T> java.util.Set<T> createTransactionalSet()
public static <T> java.util.Set<T> createTransactionalSet(java.util.Set<T> set)
public static <T> java.util.List<T> createTransactionalList()
public static <T> java.util.List<T> createTransactionalList(java.util.List<T> list)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||