[Introspection]Probleme IllegalArgument Exception
Bonjour,
suite à l'utilisation de la méthode "invoke()" je me retrouve avec la levée de l'Exception suivante:
Code:
1 2 3 4 5 6 7 8 9
| java.lang.IllegalArgumentException
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.IllegalArgumentException.<init>(IllegalArgumentException.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
at java.lang.reflect.Method.invoke(Method.java) |
Ce que je trouve bizarre, c'est que je pense avoir mis le bon type.
Mon bean:
Code:
1 2 3 4 5 6 7 8 9 10 11
| public class TotoBean{
private Long idToto;
public Long getIdToto() {
return idToto;
}
public void setIdToto(Long pIdToto) {
idToto = pIdToto;
} |
Mon code appelant invoke:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| protected Object executeBeanMethod(
Object bean,
String reqParameter,
Field field,
Class beanClass,
Class typeClass)
throws Exception
{
Object[] values = { reqParameter };
Class[] parameters = { typeClass };
beanClass
.getMethod(
(ConstanteManager.LABEL_MUTATOR
+ field.getName().substring(0, 1).toUpperCase()
+ field.getName().substring(1)),
parameters)
.invoke(bean, values);
return bean;
} |
Où:
- bean est TotoBean initialisé
- reqParameter est égal à 1
- field est private TotoBean.idToto
- beanClass est TotoBean
- typeClass est java.lang.Long
Je ne vois pas où est mon erreur 8O