|
|
|
|||||
|
FR (slice, amd, java): ability to specify callback class name
Hi,
we have a lot of methods with same result signature, like: Code:
string getBanana(long id); string updateBanana(long id, string param); string findBananas(); When using AMD, three similar callback interfaces will be generated: Code:
AMD_Banana_getBanana AMD_Banana_updateBanana AMD_Banana_findBananas Code:
void ice_response(String __ret); void ice_exception(java.lang.Exception ex); Code:
["amd:cb_class=com.mycompany.proj.IceXmlCb"] string getBanana(long id); ["amd:cb_class=com.mycompany.proj.IceXmlCb"] string updateBanana(long id, string param); ["amd:cb_class=com.mycompany.proj.IceXmlCb"] string findBananas(); Motivation: such callback interface (because there is only one interface) could be used in framework. For example, we could have method Code:
void executeQueryAsync(
String sqlQuery, params, IceXmlCb cb) { ... }
Code:
getBananas(cb) {
executeQuery("SELECT * FROM banana", { }, cb); }
getBanana(cb, id) {
executeQuery("SELECT * FROM banana WHERE id = ?", { id }, cb); }
updateBanana(cb, id, param) {
executeQuery("UPDATE banana SET a = ? WHERE id = ?", { param, id }, cb); }
Code:
getBananas(cb) {
executeQuery("SELECT ...", { }, new IceXmlCb() {
void ice_response(r) { cb.ice_response(r); }
void ice_exeption(e) { cb.ice_exception(e); }
}
}
getBanana(...) { /* copy-paste */ }
updateBanana(...} /* copy-paste */ }
Alternative Feature Request Ice should have base AMD callback interface like Code:
interface Ice.AMD_CallbackBase<R> {
void ice_response(R r);
void ice_exception(Exception e);
}
Code:
interface AMD_Bananas_getBanana extends AMD_CallbackBase<String> {
void ice_response(R r);
void ice_exception(Exception e);
}
Code:
void executeQueryAsync(
String sqlQuery, params, AMD_CallbackBase<String> cb) { ... }
|
|
|||||
|
I would also love something like this in Java. Even the second suggestion -- implementing a common super-interface -- would greatly clean up some of my code. At one point, I have a large number of callback-response classes that are pretty much identical, and it would be much nicer if I only had to write that code once.
__________________
Mary Ellen Foster Technical University of Munich JAST human-robot dialogue system Maintainer of Fedora Ice packages |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to make abstract SLICE class | peterlspot | Help Center | 2 | 01-17-2008 02:14 AM |
| enumerate derived class names of a given slice class | peterlspot | Comments | 1 | 11-29-2007 08:26 AM |
| Slice class data members -> private in Java/C++? | sasho2 | Help Center | 3 | 04-09-2007 04:28 PM |
| Intializing members of a slice generated class | Venkat Seeth | Help Center | 3 | 02-22-2005 01:31 PM |
| May slice struct contain class? | minifat | Help Center | 1 | 08-09-2004 10:16 PM |