[ https://issues.apache.org/jira/browse/CHAIN-56?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Tripodi resolved CHAIN-56. --------------------------------- Resolution: Fixed fixed on [version-2.0-work|https://svn.apache.org/repos/asf/commons/proper/chain/branches/version-2.0-work] branch, see [r1165075|https://svn.apache.org/viewvc?view=revision&revision=1165075] > clever Context with generic type "auto-cast" feature > ---------------------------------------------------- > > Key: CHAIN-56 > URL: https://issues.apache.org/jira/browse/CHAIN-56 > Project: Commons Chain > Issue Type: Improvement > Affects Versions: 2.0 > Reporter: Simone Tripodi > Assignee: Simone Tripodi > Fix For: 2.0 > > > Generics could help us on improving the Context class; since it is clear that > Context is a place where storing/retrieving objects identified by a key, I > propose adding two helper methods: > {code} > /** @since 2.0 */ > <T> T retrieve( String key ); > /** @since 2.0 */ > <T> void store( String key, T object ); > {code} > that would help users avoid the redundant code of type cast/checking when > assignments are already known (it throws a {{ClassCastException}} if types > are not assignable). At the same time, old pattern is supported, users can > choose their > preferred way to go, depending on their needs. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira