Added helper to get transactionally-bound List, Map and Set resources

- Generics allow the following, for instance:
   Map<NodeRef,List<QName>> filters = TransactionalResourceHelper.getMap(KEY_NODEREF_FILTER);


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13794 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-04-01 13:17:52 +00:00
parent b83115a62c
commit e7d9ce8fc6
3 changed files with 122 additions and 2 deletions

View File

@@ -202,8 +202,11 @@ public abstract class AlfrescoTransactionSupport
*
* @param key the thread resource map key
* @return Returns a thread resource of null if not present
*
* @see TransactionalResourceHelper for helper methods to create and bind common collection types
*/
public static Object getResource(Object key)
@SuppressWarnings("unchecked")
public static <R extends Object> R getResource(Object key)
{
// get the synchronization
TransactionSynchronizationImpl txnSynch = getSynchronization();
@@ -216,7 +219,7 @@ public abstract class AlfrescoTransactionSupport
" key: " + key + "\n" +
" resource: " + resource);
}
return resource;
return (R) resource;
}
/**