KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > mop > MethodCall


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.core.mop;
32
33 import java.io.ByteArrayInputStream JavaDoc;
34 import java.io.ByteArrayOutputStream JavaDoc;
35 import java.lang.reflect.InvocationTargetException JavaDoc;
36 import java.lang.reflect.Method JavaDoc;
37
38 import org.apache.log4j.Logger;
39
40 import sun.rmi.server.MarshalInputStream;
41 import sun.rmi.server.MarshalOutputStream;
42
43
44 /**
45  * Instances of this class represent method calls performed on reified
46  * objects. They are generated by a <I>stub object</I>, whose role is to act
47  * as a representative for the reified object.
48  *
49  * @author Julien Vayssi&egrave;re
50  */

51 public class MethodCall implements java.io.Serializable JavaDoc {
52     // COMPONENTS added a tag for identification of component requests
53
private String JavaDoc tag;
54
55     // COMPONENTS added a field for the Fractal interface name
56
// (the name of the interface containing the method called)
57
private String JavaDoc fcFunctionalInterfaceName;
58
59     //
60
// --- STATIC MEMBERS -----------------------------------------------------------------------
61
//
62

63     /**
64      * The hashtable that caches Method/isAsynchronousCall
65      * This dramatically improves performances, since we do not have to call
66      * isAsynchronousCall for every call, but only once for a given method
67      */

68     private static transient java.util.Hashtable JavaDoc ASYNORNOT = new java.util.Hashtable JavaDoc();
69
70     private static Logger logger = Logger.getLogger(MethodCall.class.getName());
71
72     /**
73      * The size of the pool we use for recycling MethodCall objects.
74      */

75     private static int RECYCLE_POOL_SIZE = 30;
76
77     /**
78      * The pool of recycled methodcall objects
79      */

80     private static MethodCall[] recyclePool;
81
82     /**
83      * Position inside the pool
84      */

85     private static int index;
86
87     /** Indicates if the recycling of MethodCall object is on. */
88     private static boolean recycleMethodCallObject;
89     private static java.util.Hashtable JavaDoc reifiedMethodsTable = new java.util.Hashtable JavaDoc();
90
91     //tag for component calls
92
public static final String JavaDoc COMPONENT_TAG = "component-methodCall";
93
94     /**
95      * Initializes the recycling of MethodCall objects to be enabled by default.
96      */

97     static {
98         MethodCall.setRecycleMethodCallObject(false);
99     }
100
101     //
102
// --- PRIVATE MEMBERS -----------------------------------------------------------------------
103
//
104

105     /**
106      * The array holding the argments of the method call
107      */

108     private Object JavaDoc[] effectiveArguments;
109
110     /**
111      * The method corresponding to the call
112      */

113     private transient Method JavaDoc reifiedMethod;
114
115     /**
116      * The internal ID of the methodcall
117      */

118     private long methodCallID;
119     private String JavaDoc key;
120
121     /**
122      * byte[] to store effectiveArguments. Requiered to optimize multiple serialization
123      * in some case (such as group communication) or to create a stronger
124      * asynchronism (serialization of parameters then return to the thread of
125      * execution before the end of the rendez-vous).
126      */

127     private byte[] serializedEffectiveArguments = null;
128
129     /**
130      * transform the effectiveArguments into a byte[]
131      * */

132     public void transformEffectiveArgumentsIntoByteArray() {
133         if ((serializedEffectiveArguments == null) &&
134                 (effectiveArguments != null)) {
135             try {
136                 ByteArrayOutputStream JavaDoc byteArrayOutputStream = new ByteArrayOutputStream JavaDoc();
137
138                 // ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
139
MarshalOutputStream objectOutputStream = new MarshalOutputStream(byteArrayOutputStream);
140                 objectOutputStream.writeObject(effectiveArguments);
141                 objectOutputStream.flush();
142                 objectOutputStream.close();
143                 byteArrayOutputStream.close();
144                 serializedEffectiveArguments = byteArrayOutputStream.toByteArray();
145             } catch (Exception JavaDoc e) {
146                 e.printStackTrace();
147             }
148             effectiveArguments = null;
149         }
150     }
151
152     /**
153      * Sets recycling of MethodCall objects on/off. Note that turning the recycling
154      * off and on again results in the recycling pool being flushed, thus damaging
155      * performances.
156      * @param value sets the recycling on if <code>true</code>, otherwise turns it off.
157      */

158     public static synchronized void setRecycleMethodCallObject(boolean value) {
159         if (recycleMethodCallObject == value) {
160             return;
161         } else {
162             recycleMethodCallObject = value;
163             if (value) {
164                 // Creates the recycle poll for MethodCall objects
165
recyclePool = new MethodCall[RECYCLE_POOL_SIZE];
166                 index = 0;
167             } else {
168                 // If we do not want to recycle MethodCall objects anymore,
169
// let's free some memory by permitting the reyclePool to be
170
// garbage-collecting
171
recyclePool = null;
172             }
173         }
174     }
175
176     /**
177      * Indicates if the recycling of MethodCall objects is currently running or not.
178      *
179      * @return <code>true</code> if recycling is on, <code>false</code> otherwise
180      */

181     public static synchronized boolean getRecycleMethodCallObject() {
182         return MethodCall.recycleMethodCallObject;
183     }
184
185     /**
186      * Factory method for getting MethodCall objects
187      *
188      * @param reifiedMethod a <code>Method</code> object that represents
189      * the method whose invocation is reified
190      * @param effectiveArguments the effective arguments of the call. Arguments
191      * that are of primitive type need to be wrapped
192      * within an instance of the corresponding wrapper
193      * class (like <code>java.lang.Integer</code> for
194      * primitive type <code>int</code> for example).
195      * @return a MethodCall object representing an invocation of method
196      * <code>reifiedMethod</code> with arguments <code>effectiveArguments</code>
197      */

198     public synchronized static MethodCall getMethodCall(Method JavaDoc reifiedMethod,
199         Object JavaDoc[] effectiveArguments) {
200         if (MethodCall.getRecycleMethodCallObject()) {
201             // Finds a recycled MethodCall object in the pool, cleans it and
202
// eventually returns it
203
if (MethodCall.index > 0) {
204                 // gets the object from the pool
205
MethodCall.index--;
206                 MethodCall result = MethodCall.recyclePool[MethodCall.index];
207                 MethodCall.recyclePool[MethodCall.index] = null;
208                 // Refurbishes the object
209
result.reifiedMethod = reifiedMethod;
210                 result.effectiveArguments = effectiveArguments;
211                 result.key = buildKey(reifiedMethod);
212                 return result;
213             } else {
214                 return new MethodCall(reifiedMethod, effectiveArguments);
215             }
216         } else {
217             return new MethodCall(reifiedMethod, effectiveArguments);
218         }
219     }
220
221     /**
222      * Returns a MethodCall object with extra info for component calls (the
223      * possible name of the functional interface invoked).
224      * @param reifiedMethod
225      * @param effectiveArguments
226      * @param fcFunctionalInterfaceName fractal interface name, whose value is :
227      * - null if the call is non-functional
228      * - the name of the functional interface otherwise
229      * @return MethodCall
230      */

231     public synchronized static MethodCall getComponentMethodCall(
232         Method JavaDoc reifiedMethod, Object JavaDoc[] effectiveArguments,
233         String JavaDoc fcFunctionalInterfaceName) {
234         // COMPONENTS
235
MethodCall mc = MethodCall.getMethodCall(reifiedMethod,
236                 effectiveArguments);
237         mc.setTag(COMPONENT_TAG);
238         mc.setFcFunctionalInterfaceName(fcFunctionalInterfaceName);
239         return mc;
240     }
241
242     /**
243      * Tells the recyclying process that the MethodCall object passed as parameter
244      * is ready for recycling. It is the responsibility of the caller of this
245      * method to make sure that this object can safely be disposed of.
246      */

247     public synchronized static void setMethodCall(MethodCall mc) {
248         if (MethodCall.getRecycleMethodCallObject()) {
249             // If there's still one slot left in the pool
250
if (MethodCall.recyclePool[MethodCall.index] == null) {
251                 // Cleans up a MethodCall object
252
// It is prefereable to do it here rather than at the moment
253
// the object is picked out of the pool, because it allows
254
// garbage-collecting the objects referenced in here
255
mc.fcFunctionalInterfaceName = null;
256                 mc.tag = null;
257                 mc.reifiedMethod = null;
258                 mc.effectiveArguments = null;
259                 mc.key = null;
260                 // Inserts the object in the pool
261
MethodCall.recyclePool[MethodCall.index] = mc;
262                 MethodCall.index++;
263                 if (MethodCall.index == RECYCLE_POOL_SIZE) {
264                     MethodCall.index = RECYCLE_POOL_SIZE - 1;
265                 }
266             }
267         }
268     }
269
270     /**
271      * Builds a new MethodCall object.
272      * Please, consider use the factory method <code>getMethodCall</code>
273      * instead of build a new MethodCall object.
274      */

275
276     // This constructor is private to this class
277
// because we want to enforce the use of factory methods for getting fresh
278
// instances of this class (see <I>Factory</I> pattern in GoF).
279
public MethodCall(Method JavaDoc reifiedMethod, Object JavaDoc[] effectiveArguments) {
280         this.reifiedMethod = reifiedMethod;
281         this.effectiveArguments = effectiveArguments;
282         this.key = buildKey(reifiedMethod);
283     }
284
285     /**
286      * Builds a new MethodCall object. This constructor is a copy constructor.
287      * Fields of the object are also copied.
288      * Please, consider use the factory method <code>getMethodCall</code>
289      * instead of build a new MethodCall object.
290      * @param mc - the MethodCall object to copy
291      */

292     public MethodCall(MethodCall mc) {
293         try {
294             this.fcFunctionalInterfaceName = mc.getFcFunctionalInterfaceName();
295             this.reifiedMethod = mc.getReifiedMethod();
296             this.tag = mc.getTag();
297             if (mc.serializedEffectiveArguments == null) {
298                 serializedEffectiveArguments = null;
299             } else {
300                 // array copy
301
byte[] source = mc.serializedEffectiveArguments;
302                 serializedEffectiveArguments = new byte[source.length];
303                 for (int i = 0; i < serializedEffectiveArguments.length; i++) {
304                     serializedEffectiveArguments[i] = source[i];
305                 }
306             }
307             if (mc.effectiveArguments == null) {
308                 effectiveArguments = null;
309             } else {
310                 // je crois que c'est bon ...
311
effectiveArguments = (Object JavaDoc[]) Utils.makeDeepCopy(mc.effectiveArguments);
312             }
313             this.key = MethodCall.buildKey(mc.getReifiedMethod());
314             // methodcallID?
315
} catch (java.io.IOException JavaDoc e) {
316             e.printStackTrace();
317         }
318     }
319
320     /**
321      * Builds a new MethodCall object.
322      */

323     protected MethodCall() {
324         this.reifiedMethod = null;
325         this.effectiveArguments = null;
326         this.serializedEffectiveArguments = null;
327     }
328
329
330     /**
331      * Executes the instance method call represented by this object.
332      *
333      * @param targetObject the Object the method is called on
334      * @throws MethodCallExecutionFailedException thrown if the refleciton of the
335      * call failed.
336      * @throws InvocationTargetException thrown if the execution of the reified
337      * method terminates abruptly by throwing an exception. The exception
338      * thrown by the execution of the reified method is placed inside the
339      * InvocationTargetException object.
340      * @return the result of the invocation of the method. If the method returns
341      * <code>void</code>, then <code>null</code> is returned. If the method
342      * returned a primitive type, then it is wrapped inside the appropriate
343      * wrapper object.
344      */

345     public Object JavaDoc execute(Object JavaDoc targetObject)
346         throws InvocationTargetException JavaDoc, MethodCallExecutionFailedException {
347         // A test at how non-public methods can be reflected
348
if ((serializedEffectiveArguments != null) &&
349                 (effectiveArguments == null)) {
350             try {
351                 ByteArrayInputStream JavaDoc byteArrayInputStream = new ByteArrayInputStream JavaDoc(serializedEffectiveArguments);
352
353                 //ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
354
MarshalInputStream objectInputStream = new MarshalInputStream(byteArrayInputStream);
355                 effectiveArguments = (Object JavaDoc[]) objectInputStream.readObject();
356                 objectInputStream.close();
357                 byteArrayInputStream.close();
358             } catch (Exception JavaDoc e) {
359                 e.printStackTrace();
360             }
361             serializedEffectiveArguments = null;
362         }
363         if (logger.isDebugEnabled()) {
364             logger.debug("MethodCall.execute() name = " + this.getName());
365             logger.debug("MethodCall.execute() reifiedMethod = " +
366                 reifiedMethod);
367             logger.debug(
368                 "MethodCall.execute() reifiedMethod.getDeclaringClass() = " +
369                 reifiedMethod.getDeclaringClass());
370             logger.debug("MethodCall.execute() targetObject " + targetObject);
371         }
372         if (reifiedMethod.getParameterTypes().length > 0) {
373             reifiedMethod.setAccessible(true);
374         }
375         try {
376             return reifiedMethod.invoke(targetObject, effectiveArguments);
377         } catch (IllegalAccessException JavaDoc e) {
378             throw new MethodCallExecutionFailedException(
379                 "Access rights to the method denied: " + e);
380         }
381     }
382
383     protected void finalize() {
384         MethodCall.setMethodCall(this);
385     }
386
387     public Method JavaDoc getReifiedMethod() {
388         return reifiedMethod;
389     }
390
391     /**
392      * Returns the name of the method
393      * @return the name of the method
394      */

395     public String JavaDoc getName() {
396         return reifiedMethod.getName();
397     }
398
399     public int getNumberOfParameter() {
400         return this.effectiveArguments.length;
401     }
402
403     public Object JavaDoc getParameter(int index) {
404         return this.effectiveArguments[index];
405     }
406
407     public void setEffectiveArguments(Object JavaDoc[] o) {
408         effectiveArguments = o;
409     }
410
411     /**
412      * Make a deep copy of all arguments of the constructor
413      */

414     public void makeDeepCopyOfArguments() throws java.io.IOException JavaDoc {
415         effectiveArguments = (Object JavaDoc[]) Utils.makeDeepCopy(effectiveArguments);
416     }
417
418     /**
419      * accessor for the functional name ot the invoked Fractal interface
420      * @return the functional name of the invoked Fractal interface
421      */

422     public String JavaDoc getFcFunctionalInterfaceName() {
423         return fcFunctionalInterfaceName;
424     }
425
426     /**
427      * setter for the functional name of the invoked Fractal interface
428      * @param the functional name of the invoked Fractal interface
429      */

430     public void setFcFunctionalInterfaceName(String JavaDoc string) {
431         fcFunctionalInterfaceName = string;
432     }
433
434     /**
435      * setter for the tag of the method call
436      */

437     public void setTag(String JavaDoc string) {
438         tag = string;
439     }
440
441     /**
442      * accessor for the tag of the method call
443      * @return the tag of the method call
444      */

445     public String JavaDoc getTag() {
446         return tag;
447     }
448
449     //
450
// --- PRIVATE METHODS -----------------------------------------------------------------------
451
//
452
private Class JavaDoc[] fixBugRead(FixWrapper[] para) {
453         Class JavaDoc[] tmp = new Class JavaDoc[para.length];
454         for (int i = 0; i < para.length; i++) {
455             // System.out.println("fixBugRead for " + i + " value is " +para[i]);
456
tmp[i] = para[i].getWrapped();
457         }
458         return tmp;
459     }
460
461     private FixWrapper[] fixBugWrite(Class JavaDoc[] para) {
462         FixWrapper[] tmp = new FixWrapper[para.length];
463         for (int i = 0; i < para.length; i++) {
464             // System.out.println("fixBugWrite for " + i + " out of " + para.length + " value is " +para[i] );
465
tmp[i] = new FixWrapper(para[i]);
466         }
467         return tmp;
468     }
469
470     private static String JavaDoc buildKey(Method JavaDoc reifiedMethod) {
471         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
472         sb.append(reifiedMethod.getDeclaringClass().getName());
473         sb.append(reifiedMethod.getName());
474         Class JavaDoc[] parameters = reifiedMethod.getParameterTypes();
475         for (int i = 0; i < parameters.length; i++) {
476             sb.append(parameters[i].getName());
477         }
478         return sb.toString();
479     }
480
481     //
482
// --- PRIVATE METHODS FOR SERIALIZATION --------------------------------------------------------------
483
//
484
private void writeObject(java.io.ObjectOutputStream JavaDoc out)
485         throws java.io.IOException JavaDoc {
486             this.writeTheObject(out);
487     }
488
489     protected void writeTheObject(java.io.ObjectOutputStream JavaDoc out)
490         throws java.io.IOException JavaDoc {
491         out.defaultWriteObject();
492         // The Method object needs to be converted
493
out.writeObject(reifiedMethod.getDeclaringClass());
494         out.writeObject(reifiedMethod.getName());
495         out.writeObject(fixBugWrite(reifiedMethod.getParameterTypes()));
496     }
497
498
499     private void readObject(java.io.ObjectInputStream JavaDoc in)
500         throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc {
501             this.readTheObject(in);
502     }
503
504
505     protected void readTheObject(java.io.ObjectInputStream JavaDoc in)
506         throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc {
507         in.defaultReadObject();
508         reifiedMethod = (Method JavaDoc) reifiedMethodsTable.get(key);
509         if (reifiedMethod == null) {
510             // Reads several pieces of data that we need for looking up the method
511
Class JavaDoc declaringClass = (Class JavaDoc) in.readObject();
512             String JavaDoc simpleName = (String JavaDoc) in.readObject();
513             Class JavaDoc[] parameters = this.fixBugRead((FixWrapper[]) in.readObject());
514
515             // Looks up the method
516
try {
517                 reifiedMethod = declaringClass.getMethod(simpleName, parameters);
518                 reifiedMethodsTable.put(key, reifiedMethod);
519             } catch (NoSuchMethodException JavaDoc e) {
520                 throw new InternalException("Lookup for method failed: " + e +
521                     ". This may be caused by having different versions of the same class on different VMs. Check your CLASSPATH settings.");
522             }
523         } else { //added to avoid an ibis bug
524
in.readObject();
525             in.readObject();
526             in.readObject();
527         }
528         if ((serializedEffectiveArguments != null) &&
529                 (effectiveArguments == null)) {
530             try {
531                 ByteArrayInputStream JavaDoc byteArrayInputStream = new ByteArrayInputStream JavaDoc(serializedEffectiveArguments);
532
533                 // ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
534
MarshalInputStream objectInputStream = new MarshalInputStream(byteArrayInputStream);
535                 effectiveArguments = (Object JavaDoc[]) objectInputStream.readObject();
536                 objectInputStream.close();
537                 byteArrayInputStream.close();
538             } catch (Exception JavaDoc e) {
539                 e.printStackTrace();
540             }
541             serializedEffectiveArguments = null;
542         }
543     }
544
545
546     /**
547      * Returns a boolean saying whether the method is one-way or not.
548      * Being one-way method is equivalent to <UL>
549      * <LI>having <code>void</code> as return type
550      * <LI>and not throwing any checked exceptions</UL>
551      * @return true if and only if the method call is one way
552      */

553     public boolean isOneWayCall() {
554         return (this.getReifiedMethod().getReturnType().equals(java.lang.Void.TYPE)) && (this.getReifiedMethod().getExceptionTypes().length == 0);
555     }
556
557
558     /**
559      * Checks if the <code>Call</code> object can be
560      * processed with a future semantics, i-e if its returned object
561      * can be a future object.
562      *
563      * Two conditions must be met : <UL>
564      * <LI> The returned object is reifiable
565      * <LI> The invoked method does not throw any exceptions
566      * </UL>
567      * @return true if and only if the method call is asynchronous
568      */

569     public boolean isAsynchronousWayCall() {
570         Method JavaDoc m = this.getReifiedMethod();
571         // Is the result cached ?
572
Boolean JavaDoc b = (Boolean JavaDoc)MethodCall.ASYNORNOT.get(m);
573         if (b != null) {
574           return b.booleanValue();
575         } else // Computes the result
576
{
577           boolean result;
578           // A Method that returns void is the only case where a method that returns
579
// a non-reifiable type is asynchronous
580
if (this.isOneWayCall()) {
581             result = true;
582           } else {
583             try {
584               MOP.checkClassIsReifiable(m.getReturnType());
585               // If the method can throw exceptions, then the result if false
586
if (m.getExceptionTypes().length > 0) {
587                 //System.out.println(" ------ isAsynchronousCall() The method can throw exceptions ");
588
result = false;
589               } else {
590                 result = true;
591               }
592             } catch (ClassNotReifiableException e) {
593               //System.out.println(" ------ isAsynchronousCall() The class " + m.getReturnType() + " is not reifiable ");
594
result = false;
595             }
596             // Now that we have computed the result, let's cache it
597
//System.out.println(" ------ isAsynchronousCall() method " + m + " ===> "+result);
598
MethodCall.ASYNORNOT.put(m, new Boolean JavaDoc(result));
599           }
600           return result;
601         }
602
603     }
604
605     //
606
// --- INNER CLASSES -----------------------------------------------------------------------
607
//
608
public class FixWrapper implements java.io.Serializable JavaDoc {
609         public boolean isPrimitive;
610         public Class JavaDoc encapsulated;
611
612         public FixWrapper() {
613         }
614
615         /**
616          * Encapsulate primitives types into Class
617          */

618         public FixWrapper(Class JavaDoc c) {
619             if (!c.isPrimitive()) {
620                 encapsulated = c;
621                 return;
622             }
623             isPrimitive = true;
624             if (c.equals(Boolean.TYPE)) {
625                 encapsulated = Boolean JavaDoc.class;
626             } else if (c.equals(Byte.TYPE)) {
627                 encapsulated = Byte JavaDoc.class;
628             } else if (c.equals(Character.TYPE)) {
629                 encapsulated = Character JavaDoc.class;
630             } else if (c.equals(Double.TYPE)) {
631                 encapsulated = Double JavaDoc.class;
632             } else if (c.equals(Float.TYPE)) {
633                 encapsulated = Float JavaDoc.class;
634             } else if (c.equals(Integer.TYPE)) {
635                 encapsulated = Integer JavaDoc.class;
636             } else if (c.equals(Long.TYPE)) {
637                 encapsulated = Long JavaDoc.class;
638             } else if (c.equals(Short.TYPE)) {
639                 encapsulated = Short JavaDoc.class;
640             }
641         }
642
643         /**
644          * Give back the original class
645          */

646         public Class JavaDoc getWrapped() {
647             if (!isPrimitive) {
648                 return encapsulated;
649             }
650             if (encapsulated.equals(Boolean JavaDoc.class)) {
651                 return Boolean.TYPE;
652             }
653             if (encapsulated.equals(Byte JavaDoc.class)) {
654                 return Byte.TYPE;
655             }
656             if (encapsulated.equals(Character JavaDoc.class)) {
657                 return Character.TYPE;
658             }
659             if (encapsulated.equals(Double JavaDoc.class)) {
660                 return Double.TYPE;
661             }
662             if (encapsulated.equals(Float JavaDoc.class)) {
663                 return Float.TYPE;
664             }
665             if (encapsulated.equals(Integer JavaDoc.class)) {
666                 return Integer.TYPE;
667             }
668             if (encapsulated.equals(Long JavaDoc.class)) {
669                 return Long.TYPE;
670             }
671             if (encapsulated.equals(Short JavaDoc.class)) {
672                 return Short.TYPE;
673             }
674             throw new InternalException("FixWrapper encapsulated class unkown " +
675                 encapsulated);
676         }
677
678         public String JavaDoc toString() {
679             return "FixWrapper: " + encapsulated.toString();
680         }
681     }
682
683     // end inner class FixWrapper
684
}
685
Popular Tags