Hmm, just went ahead and
tried the original code, and it workedJ:
private Object[] fillParameters() {
Object param[] = new Object[parameters.size()];
for (int i = 0; i < parameters.size(); i++) {
Object[] params = (Object[]) parameters.get(i);
Class clazz = (Class) params[0];
param[i] = ((IModel) params[1]).getObject(null);
}
return param;
} From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nino Wael So there is no simple
solution like this, which does not work: param[i] = (clazz) ((IModel)
params[1]).getObject(null); or (purely fictional) param[i] = (clazz.getType) ((IModel)
params[1]).getObject(null); From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner you have to make sure
that the object[] that you give to the invoke On 9/26/06, Nino
Wael <[EMAIL PROTECTED]>
wrote: fillParameters should have looked like this
private Object[] fillParameters() {
Object param[] = new Object[parameters.size()];
for (int i = 0; i < parameters.size(); i++) {
Object[] params = (Object[]) parameters.get(i);
Class clazz = (Class) params[0];
param[i] = ((IModel) params[1]).getObject(null);
}
return param;
} From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Nino Wael Hi I need to do something similar as the propertyresolver does. Therefore
im writing to the wicket userlist. I have a component that can update a list of other components by a It gets the value by calling a method which were provided and the
required parameters was also provided, it does this by using
java.lang.reflect.Method. In my effort on trying to make this a bit more generic component I was
trying to have an arraylist which contained class's and IModels. Setting up the method was fine and simple enough, currently im stuck
when trying to build the list of parameters im wondering if I have to typecast
the parameters at all or if reflection will handle that, because of what I did
in the setupMethod method, I am betting the latter? //sniplet
private void setupMethod(Object myProvider, String sMethod) {
Class partypes[] = new Class[parameters.size()];
for (int i = 0; i < parameters.size(); i++) {
Object[] params = (Object[]) parameters.get(i);
partypes[i] = (Class) params[0];
}
Method method;
try {
method = myProvider.getClass().getMethod(sMethod, partypes);
} catch (Exception e) { …
}
this.dbprovidermethod = method;
}
private Object[] fillParameters()
{
Object param[] = new Object[parameters.size()];
for (int i = 0; i < parameters.size(); i++) {
Object[] params = (Object[]) parameters.get(i);
Class clazz=(Class) params[0];
param[i] = (clazz) params[1];
}
return param;
} //sniplet
|
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user