The original post became unavailable after a reply with code:
anonymous wrote :
| Hi,
|
| I'm pleased to join you here.
|
| I have a problem with the annotation Java 1.4 together with a Class[] parameter.
My annotation is related to a refactoring initiative
| to avoid repeating all the lookup/narrow stuff when using EJB. The annotation tag
is:
|
| @@annot.ejblookup
(invocarConstrutorParmsArray={br.com.ilheus.hotels.HotelManagerHome,java.lang.String,float,
|
net.sourceforge.junitejb.EJBTestCase,br.com.ilheus.hotels.ReservationLocalHome,int})
|
| Thus the annotation class is:
|
| package annot;
| public interface ejblookup {
| Class[] invocarConstrutorParmsArray();
| }
|
| The problem is:
|
| 20:01:23,686 INFO [HomeLookupTest] Starting: testLookup
| 20:01:23,702 INFO [STDOUT] java.lang.RuntimeException: java.lang.RuntimeExcepti
| on: java.lang.ClassNotFoundException: No ClassLoaders found for: float
| 20:01:23,702 INFO [STDOUT] at org.jboss.aop.annotation.AnnotationElement.ge
| tVisibleAnnotation(AnnotationElement.java:92)
| 20:01:23,702 INFO [STDOUT] at org.jboss.aop.annotation.AnnotationElement.ge
| tAnyAnnotation(AnnotationElement.java:107)
| 20:01:23,702 INFO [STDOUT] at br.com.ilheus.hotels.aspects.EjbHomeLookupInt
| erceptor.invoke(EjbHomeLookupInterceptor.java:41)
|
| The AnnotationElement class don't deal correctly with primitive classes. The
Class[] has the constructor parameters that should be
| invoked instead of the constructor annotated. The parameters should also be
delegated and I don't want to refactor the primitive types to their
| wrapper classes. Moreover, the EJB dependencies would be provided in a IoC fashion.
|
| Maybe, it is a conceptual issue related to the reflection and the javassist API.
Any clarification?
|
|
Bill Burke had replied that this is a bug on the framework.
As a workaround: I used a comma-separated list as String:
| package annot;
| public interface ejblookup {
| String invocarConstrutorParmsArray();
| }
|
| @@annot.ejblookup
(invocarConstrutorParmsArray="br.com.ilheus.hotels.HotelManagerHome,java.lang.String,float,
|
net.sourceforge.junitejb.EJBTestCase,br.com.ilheus.hotels.ReservationLocalHome,int")
|
| String [] parms = annotejb.invocarConstrutorParms().split(",");
| Class [] parmsClassArray = new Class[parms.length];
| for (int cont = 0; cont < parms.length; cont++) {
| if (parms[cont].equals("char")) parmsClassArray[cont] = Character.TYPE;
| else if (parms[cont].equals("byte")) parmsClassArray[cont]= Byte.TYPE;
| else if (parms[cont].equals("short")) parmsClassArray[cont] = Short.TYPE;
| else if (parms[cont].equals("int")) parmsClassArray[cont] = Integer.TYPE;
| else if (parms[cont].equals("long")) parmsClassArray[cont] = Long.TYPE;
| else if (parms[cont].equals("float")) parmsClassArray[cont] = Float.TYPE;
| else if (parms[cont].equals("double")) parmsClassArray[cont] = Double.TYPE;
| else parmsClassArray[cont] = Class.forName(parms[cont]);
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3845815#3845815
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3845815
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development