Re: Type-safe Prevayler, using generics
Karl Wettin <[email protected]>
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <[email protected]> |
Cool! I'm all for a merge!
karl
29 okt 2011 kl. 00.54 skrev Naveen Chawla:
> Small point, but by using generics, Prevayler has complete type-safety minus casting. Took me longer than expected, but I've attempted this on Prevayler source. I submitted a "fork" on the prevayler git - https://github.com/Navigateur/prevayler - I'm not very good at git, but I think that's how you want contributions submitted. Needs run time testing. Demo and test code modified to match. Summary usage:
>
> instead of
> Prevayler prevayler
> use
> Prevayler<MyTypeToPrevail> prevayler
>
> and instead of
> PrevaylerFactory prevaylerFactory
> use
> PrevaylerFactory<MyTypeToPrevail> prevaylerFactory
>
> For your custom transactions/queries:
> replace
> implements Transaction{
> with
> implements Transaction<MyTypeToPrevail>{
>
> and
> implements TransactionWithQuery{
> with
> implements TransactionWithQuery<MyTypeToPrevail, MyTypeToReturn>{
> same for Query, SureTransactionWithQuery
>
> Then, you don't do any casting from Object to prevalent type, nor from ".execute" to return type, as these arrive in native form.
> ("MyTypeToPrevail" is compiler-checked as implementing Serializable in all the above cases)
>
> i.e. instead of
> (MyTypeToPrevail)prevalentSystem
> you just use
> prevalentSystem
> and instead of
> (MyTypeToReturn)prevayler.execute(...
> you just use
> prevayler.execute(...
>
> It might even run faster due to lack of run time casting on each transaction/query, who knows (not me). Hopefully you can test, and as soon as it works immediately release it as an update, or at least an immediate parallel choice as I really want this version now but with your genuine backing.
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev_______________________________________________
> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org