1 /* java.lang.reflect.Field - reflection of Java fields
2 Copyright (C) 1998, 2001, 2005, 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.lang.reflect;
41 import gnu.java.lang.ClassHelper;
43 import gnu.java.lang.reflect.FieldSignatureParser;
44 import java.lang.annotation.Annotation;
47 * The Field class represents a member variable of a class. It also allows
48 * dynamic access to a member, via reflection. This works for both
49 * static and instance fields. Operations on Field objects know how to
50 * do widening conversions, but throw {@link IllegalArgumentException} if
51 * a narrowing conversion would be necessary. You can query for information
52 * on this Field regardless of location, but get and set access may be limited
53 * by Java language access controls. If you can't do it in the compiler, you
54 * can't normally do it here either.<p>
56 * <B>Note:</B> This class returns and accepts types as Classes, even
57 * primitive types; there are Class types defined that represent each
58 * different primitive type. They are <code>java.lang.Boolean.TYPE,
59 * java.lang.Byte.TYPE,</code>, also available as <code>boolean.class,
60 * byte.class</code>, etc. These are not to be confused with the
61 * classes <code>java.lang.Boolean, java.lang.Byte</code>, etc., which are
64 * Also note that this is not a serializable class. It is entirely feasible
65 * to make it serializable using the Externalizable interface, but this is
69 * @author Eric Blake <ebb9@email.byu.edu>
70 * @author Per Bothner <bothner@cygnus.com>
73 * @see Class#getField(String)
74 * @see Class#getDeclaredField(String)
75 * @see Class#getFields()
76 * @see Class#getDeclaredFields()
78 * @status updated to 1.4
80 public final class Field
81 extends AccessibleObject implements Member
83 private Class declaringClass;
86 // Offset in bytes from the start of declaringClass's fields array.
89 // The Class (or primitive TYPE) of this field.
92 static final int FIELD_MODIFIERS
93 = Modifier.FINAL | Modifier.PRIVATE | Modifier.PROTECTED
94 | Modifier.PUBLIC | Modifier.STATIC | Modifier.TRANSIENT
97 // This is instantiated by Class sometimes, but it uses C++ and
98 // avoids the Java protection check.
104 * Gets the class that declared this field, or the class where this field
105 * is a non-inherited member.
106 * @return the class that declared this member
108 public Class<?> getDeclaringClass()
110 return declaringClass;
114 * Gets the name of this field.
115 * @return the name of this field
117 public native String getName();
120 * Return the raw modifiers for this field.
121 * @return the field's modifiers
123 private native int getModifiersInternal();
126 * Gets the modifiers this field uses. Use the <code>Modifier</code>
127 * class to interpret the values. A field can only have a subset of the
128 * following modifiers: public, private, protected, static, final,
129 * transient, and volatile.
131 * @return an integer representing the modifiers to this Member
134 public int getModifiers()
136 return getModifiersInternal() & FIELD_MODIFIERS;
140 * Return true if this field is synthetic, false otherwise.
143 public boolean isSynthetic()
145 return (getModifiersInternal() & Modifier.SYNTHETIC) != 0;
149 * Return true if this field represents an enum constant,
153 public boolean isEnumConstant()
155 return (getModifiersInternal() & Modifier.ENUM) != 0;
159 * Gets the type of this field.
160 * @return the type of this field
162 public native Class<?> getType();
165 * Compare two objects to see if they are semantically equivalent.
166 * Two Fields are semantically equivalent if they have the same declaring
167 * class, name, and type. Since you can't creat a Field except through
168 * the VM, this is just the == relation.
170 * @param o the object to compare to
171 * @return <code>true</code> if they are equal; <code>false</code> if not
173 public boolean equals (Object fld)
175 if (! (fld instanceof Field))
177 Field f = (Field) fld;
178 return declaringClass == f.declaringClass && offset == f.offset;
182 * Get the hash code for the Field. The Field hash code is the hash code
183 * of its name XOR'd with the hash code of its class name.
185 * @return the hash code for the object.
187 public int hashCode()
189 return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
193 * Get a String representation of the Field. A Field's String
194 * representation is "<modifiers> <type>
195 * <class>.<fieldname>".<br> Example:
196 * <code>public transient boolean gnu.parse.Parser.parseComplete</code>
198 * @return the String representation of the Field
200 public String toString ()
202 StringBuffer sbuf = new StringBuffer ();
203 int mods = getModifiers();
206 Modifier.toString(mods, sbuf);
209 Method.appendClassName (sbuf, getType ());
211 Method.appendClassName (sbuf, getDeclaringClass());
213 sbuf.append(getName());
214 return sbuf.toString();
217 public String toGenericString()
219 StringBuilder sb = new StringBuilder(64);
220 Modifier.toString(getModifiers(), sb).append(' ');
221 sb.append(getGenericType()).append(' ');
222 sb.append(getDeclaringClass().getName()).append('.');
223 sb.append(getName());
224 return sb.toString();
228 * Get the value of this Field. If it is primitive, it will be wrapped
229 * in the appropriate wrapper type (boolean = java.lang.Boolean).<p>
231 * If the field is static, <code>o</code> will be ignored. Otherwise, if
232 * <code>o</code> is null, you get a <code>NullPointerException</code>,
233 * and if it is incompatible with the declaring class of the field, you
234 * get an <code>IllegalArgumentException</code>.<p>
236 * Next, if this Field enforces access control, your runtime context is
237 * evaluated, and you may have an <code>IllegalAccessException</code> if
238 * you could not access this field in similar compiled code. If the field
239 * is static, and its class is uninitialized, you trigger class
240 * initialization, which may end in a
241 * <code>ExceptionInInitializerError</code>.<p>
243 * Finally, the field is accessed, and primitives are wrapped (but not
244 * necessarily in new objects). This method accesses the field of the
245 * declaring class, even if the instance passed in belongs to a subclass
246 * which declares another field to hide this one.
248 * @param o the object to get the value of this Field from
249 * @return the value of the Field
250 * @throws IllegalAccessException if you could not normally access this field
251 * (i.e. it is not public)
252 * @throws IllegalArgumentException if <code>o</code> is not an instance of
253 * the class or interface declaring this field
254 * @throws NullPointerException if <code>o</code> is null and this field
255 * requires an instance
256 * @throws ExceptionInInitializerError if accessing a static field triggered
257 * class initialization, which then failed
258 * @see #getBoolean(Object)
259 * @see #getByte(Object)
260 * @see #getChar(Object)
261 * @see #getShort(Object)
262 * @see #getInt(Object)
263 * @see #getLong(Object)
264 * @see #getFloat(Object)
265 * @see #getDouble(Object)
267 public Object get(Object obj)
268 throws IllegalAccessException
270 return get(null, obj);
274 * Get the value of this boolean Field. If the field is static,
275 * <code>o</code> will be ignored.
277 * @param o the object to get the value of this Field from
278 * @return the value of the Field
279 * @throws IllegalAccessException if you could not normally access this field
280 * (i.e. it is not public)
281 * @throws IllegalArgumentException if this is not a boolean field of
282 * <code>o</code>, or if <code>o</code> is not an instance of the
283 * declaring class of this field
284 * @throws NullPointerException if <code>o</code> is null and this field
285 * requires an instance
286 * @throws ExceptionInInitializerError if accessing a static field triggered
287 * class initialization, which then failed
290 public boolean getBoolean(Object obj)
291 throws IllegalAccessException
293 return getBoolean(null, obj);
297 * Get the value of this byte Field. If the field is static,
298 * <code>o</code> will be ignored.
300 * @param o the object to get the value of this Field from
301 * @return the value of the Field
302 * @throws IllegalAccessException if you could not normally access this field
303 * (i.e. it is not public)
304 * @throws IllegalArgumentException if this is not a byte field of
305 * <code>o</code>, or if <code>o</code> is not an instance of the
306 * declaring class of this field
307 * @throws NullPointerException if <code>o</code> is null and this field
308 * requires an instance
309 * @throws ExceptionInInitializerError if accessing a static field triggered
310 * class initialization, which then failed
313 public byte getByte(Object obj)
314 throws IllegalAccessException
316 return getByte(null, obj);
320 * Get the value of this Field as a char. If the field is static,
321 * <code>o</code> will be ignored.
323 * @throws IllegalAccessException if you could not normally access this field
324 * (i.e. it is not public)
325 * @throws IllegalArgumentException if this is not a char field of
326 * <code>o</code>, or if <code>o</code> is not an instance
327 * of the declaring class of this field
328 * @throws NullPointerException if <code>o</code> is null and this field
329 * requires an instance
330 * @throws ExceptionInInitializerError if accessing a static field triggered
331 * class initialization, which then failed
334 public char getChar(Object obj)
335 throws IllegalAccessException
337 return getChar(null, obj);
341 * Get the value of this Field as a short. If the field is static,
342 * <code>o</code> will be ignored.
344 * @param o the object to get the value of this Field from
345 * @return the value of the Field
346 * @throws IllegalAccessException if you could not normally access this field
347 * (i.e. it is not public)
348 * @throws IllegalArgumentException if this is not a byte or short
349 * field of <code>o</code>, or if <code>o</code> is not an instance
350 * of the declaring class of this field
351 * @throws NullPointerException if <code>o</code> is null and this field
352 * requires an instance
353 * @throws ExceptionInInitializerError if accessing a static field triggered
354 * class initialization, which then failed
357 public short getShort(Object obj)
358 throws IllegalAccessException
360 return getShort(null, obj);
364 * Get the value of this Field as an int. If the field is static,
365 * <code>o</code> will be ignored.
367 * @param o the object to get the value of this Field from
368 * @return the value of the Field
369 * @throws IllegalAccessException if you could not normally access this field
370 * (i.e. it is not public)
371 * @throws IllegalArgumentException if this is not a byte, short, char, or
372 * int field of <code>o</code>, or if <code>o</code> is not an
373 * instance of the declaring class of this field
374 * @throws NullPointerException if <code>o</code> is null and this field
375 * requires an instance
376 * @throws ExceptionInInitializerError if accessing a static field triggered
377 * class initialization, which then failed
380 public int getInt(Object obj)
381 throws IllegalAccessException
383 return getInt(null, obj);
387 * Get the value of this Field as a long. If the field is static,
388 * <code>o</code> will be ignored.
390 * @param o the object to get the value of this Field from
391 * @return the value of the Field
392 * @throws IllegalAccessException if you could not normally access this field
393 * (i.e. it is not public)
394 * @throws IllegalArgumentException if this is not a byte, short, char, int,
395 * or long field of <code>o</code>, or if <code>o</code> is not an
396 * instance of the declaring class of this field
397 * @throws NullPointerException if <code>o</code> is null and this field
398 * requires an instance
399 * @throws ExceptionInInitializerError if accessing a static field triggered
400 * class initialization, which then failed
403 public long getLong(Object obj)
404 throws IllegalAccessException
406 return getLong(null, obj);
410 * Get the value of this Field as a float. If the field is static,
411 * <code>o</code> will be ignored.
413 * @param o the object to get the value of this Field from
414 * @return the value of the Field
415 * @throws IllegalAccessException if you could not normally access this field
416 * (i.e. it is not public)
417 * @throws IllegalArgumentException if this is not a byte, short, char, int,
418 * long, or float field of <code>o</code>, or if <code>o</code> is
419 * not an instance of the declaring class of this field
420 * @throws NullPointerException if <code>o</code> is null and this field
421 * requires an instance
422 * @throws ExceptionInInitializerError if accessing a static field triggered
423 * class initialization, which then failed
426 public float getFloat(Object obj)
427 throws IllegalAccessException
429 return getFloat(null, obj);
433 * Get the value of this Field as a double. If the field is static,
434 * <code>o</code> will be ignored.
436 * @param o the object to get the value of this Field from
437 * @return the value of the Field
438 * @throws IllegalAccessException if you could not normally access this field
439 * (i.e. it is not public)
440 * @throws IllegalArgumentException if this is not a byte, short, char, int,
441 * long, float, or double field of <code>o</code>, or if
442 * <code>o</code> is not an instance of the declaring class of this
444 * @throws NullPointerException if <code>o</code> is null and this field
445 * requires an instance
446 * @throws ExceptionInInitializerError if accessing a static field triggered
447 * class initialization, which then failed
450 public double getDouble(Object obj)
451 throws IllegalAccessException
453 return getDouble(null, obj);
456 private native boolean getBoolean (Class caller, Object obj)
457 throws IllegalArgumentException, IllegalAccessException;
459 private native char getChar (Class caller, Object obj)
460 throws IllegalArgumentException, IllegalAccessException;
462 private native byte getByte (Class caller, Object obj)
463 throws IllegalArgumentException, IllegalAccessException;
465 private native short getShort (Class caller, Object obj)
466 throws IllegalArgumentException, IllegalAccessException;
468 private native int getInt (Class caller, Object obj)
469 throws IllegalArgumentException, IllegalAccessException;
471 private native long getLong (Class caller, Object obj)
472 throws IllegalArgumentException, IllegalAccessException;
474 private native float getFloat (Class caller, Object obj)
475 throws IllegalArgumentException, IllegalAccessException;
477 private native double getDouble (Class caller, Object obj)
478 throws IllegalArgumentException, IllegalAccessException;
480 private native Object get (Class caller, Object obj)
481 throws IllegalArgumentException, IllegalAccessException;
484 * Set the value of this Field. If it is a primitive field, the value
485 * will be unwrapped from the passed object (boolean = java.lang.Boolean).<p>
487 * If the field is static, <code>o</code> will be ignored. Otherwise, if
488 * <code>o</code> is null, you get a <code>NullPointerException</code>,
489 * and if it is incompatible with the declaring class of the field, you
490 * get an <code>IllegalArgumentException</code>.<p>
492 * Next, if this Field enforces access control, your runtime context is
493 * evaluated, and you may have an <code>IllegalAccessException</code> if
494 * you could not access this field in similar compiled code. This also
495 * occurs whether or not there is access control if the field is final.
496 * If the field is primitive, and unwrapping your argument fails, you will
497 * get an <code>IllegalArgumentException</code>; likewise, this error
498 * happens if <code>value</code> cannot be cast to the correct object type.
499 * If the field is static, and its class is uninitialized, you trigger class
500 * initialization, which may end in a
501 * <code>ExceptionInInitializerError</code>.<p>
503 * Finally, the field is set with the widened value. This method accesses
504 * the field of the declaring class, even if the instance passed in belongs
505 * to a subclass which declares another field to hide this one.
507 * @param o the object to set this Field on
508 * @param value the value to set this Field to
509 * @throws IllegalAccessException if you could not normally access this field
510 * (i.e. it is not public)
511 * @throws IllegalArgumentException if <code>value</code> cannot be
512 * converted by a widening conversion to the underlying type of
513 * the Field, or if <code>o</code> is not an instance of the class
514 * declaring this field
515 * @throws NullPointerException if <code>o</code> is null and this field
516 * requires an instance
517 * @throws ExceptionInInitializerError if accessing a static field triggered
518 * class initialization, which then failed
519 * @see #setBoolean(Object, boolean)
520 * @see #setByte(Object, byte)
521 * @see #setChar(Object, char)
522 * @see #setShort(Object, short)
523 * @see #setInt(Object, int)
524 * @see #setLong(Object, long)
525 * @see #setFloat(Object, float)
526 * @see #setDouble(Object, double)
528 public void set(Object object, Object value)
529 throws IllegalAccessException
531 set(null, object, value);
535 * Set this boolean Field. If the field is static, <code>o</code> will be
538 * @param o the object to set this Field on
539 * @param value the value to set this Field to
540 * @throws IllegalAccessException if you could not normally access this field
541 * (i.e. it is not public)
542 * @throws IllegalArgumentException if this is not a boolean field, or if
543 * <code>o</code> is not an instance of the class declaring this
545 * @throws NullPointerException if <code>o</code> is null and this field
546 * requires an instance
547 * @throws ExceptionInInitializerError if accessing a static field triggered
548 * class initialization, which then failed
549 * @see #set(Object, Object)
551 public void setBoolean(Object obj, boolean b)
552 throws IllegalAccessException
554 setBoolean(null, obj, b, true);
558 * Set this byte Field. If the field is static, <code>o</code> will be
561 * @param o the object to set this Field on
562 * @param value the value to set this Field to
563 * @throws IllegalAccessException if you could not normally access this field
564 * (i.e. it is not public)
565 * @throws IllegalArgumentException if this is not a byte, short, int, long,
566 * float, or double field, or if <code>o</code> is not an instance
567 * of the class declaring this field
568 * @throws NullPointerException if <code>o</code> is null and this field
569 * requires an instance
570 * @throws ExceptionInInitializerError if accessing a static field triggered
571 * class initialization, which then failed
572 * @see #set(Object, Object)
574 public void setByte(Object obj, byte b)
575 throws IllegalAccessException
577 setByte(null, obj, b, true);
581 * Set this char Field. If the field is static, <code>o</code> will be
584 * @param o the object to set this Field on
585 * @param value the value to set this Field to
586 * @throws IllegalAccessException if you could not normally access this field
587 * (i.e. it is not public)
588 * @throws IllegalArgumentException if this is not a char, int, long,
589 * float, or double field, or if <code>o</code> is not an instance
590 * of the class declaring this field
591 * @throws NullPointerException if <code>o</code> is null and this field
592 * requires an instance
593 * @throws ExceptionInInitializerError if accessing a static field triggered
594 * class initialization, which then failed
595 * @see #set(Object, Object)
597 public void setChar(Object obj, char c)
598 throws IllegalAccessException
600 setChar(null, obj, c, true);
604 * Set this short Field. If the field is static, <code>o</code> will be
607 * @param o the object to set this Field on
608 * @param value the value to set this Field to
609 * @throws IllegalAccessException if you could not normally access this field
610 * (i.e. it is not public)
611 * @throws IllegalArgumentException if this is not a short, int, long,
612 * float, or double field, or if <code>o</code> is not an instance
613 * of the class declaring this field
614 * @throws NullPointerException if <code>o</code> is null and this field
615 * requires an instance
616 * @throws ExceptionInInitializerError if accessing a static field triggered
617 * class initialization, which then failed
618 * @see #set(Object, Object)
620 public void setShort(Object obj, short s)
621 throws IllegalAccessException
623 setShort(null, obj, s, true);
627 * Set this int Field. If the field is static, <code>o</code> will be
630 * @param o the object to set this Field on
631 * @param value the value to set this Field to
632 * @throws IllegalAccessException if you could not normally access this field
633 * (i.e. it is not public)
634 * @throws IllegalArgumentException if this is not an int, long, float, or
635 * double field, or if <code>o</code> is not an instance of the
636 * class declaring this field
637 * @throws NullPointerException if <code>o</code> is null and this field
638 * requires an instance
639 * @throws ExceptionInInitializerError if accessing a static field triggered
640 * class initialization, which then failed
641 * @see #set(Object, Object)
643 public void setInt(Object obj, int i)
644 throws IllegalAccessException
646 setInt(null, obj, i, true);
650 * Set this long Field. If the field is static, <code>o</code> will be
653 * @param o the object to set this Field on
654 * @param value the value to set this Field to
655 * @throws IllegalAccessException if you could not normally access this field
656 * (i.e. it is not public)
657 * @throws IllegalArgumentException if this is not a long, float, or double
658 * field, or if <code>o</code> is not an instance of the class
659 * declaring this field
660 * @throws NullPointerException if <code>o</code> is null and this field
661 * requires an instance
662 * @throws ExceptionInInitializerError if accessing a static field triggered
663 * class initialization, which then failed
664 * @see #set(Object, Object)
666 public void setLong(Object obj, long l)
667 throws IllegalArgumentException, IllegalAccessException
669 setLong(null, obj, l, true);
673 * Set this float Field. If the field is static, <code>o</code> will be
676 * @param o the object to set this Field on
677 * @param value the value to set this Field to
678 * @throws IllegalAccessException if you could not normally access this field
679 * (i.e. it is not public)
680 * @throws IllegalArgumentException if this is not a float or long field, or
681 * if <code>o</code> is not an instance of the class declaring this
683 * @throws NullPointerException if <code>o</code> is null and this field
684 * requires an instance
685 * @throws ExceptionInInitializerError if accessing a static field triggered
686 * class initialization, which then failed
687 * @see #set(Object, Object)
689 public void setFloat(Object obj, float f)
690 throws IllegalAccessException
692 setFloat(null, obj, f, true);
696 * Set this double Field. If the field is static, <code>o</code> will be
699 * @param o the object to set this Field on
700 * @param value the value to set this Field to
701 * @throws IllegalAccessException if you could not normally access this field
702 * (i.e. it is not public)
703 * @throws IllegalArgumentException if this is not a double field, or if
704 * <code>o</code> is not an instance of the class declaring this
706 * @throws NullPointerException if <code>o</code> is null and this field
707 * requires an instance
708 * @throws ExceptionInInitializerError if accessing a static field triggered
709 * class initialization, which then failed
710 * @see #set(Object, Object)
712 public void setDouble(Object obj, double d)
713 throws IllegalAccessException
715 setDouble(null, obj, d, true);
719 * Return the generic type of the field. If the field type is not a generic
720 * type, the method returns the same as <code>getType()</code>.
722 * @throws GenericSignatureFormatError if the generic signature does
723 * not conform to the format specified in the Virtual Machine
724 * specification, version 3.
727 public Type getGenericType()
729 String signature = getSignature();
730 if (signature == null)
732 FieldSignatureParser p = new FieldSignatureParser(getDeclaringClass(),
734 return p.getFieldType();
737 public <T extends Annotation> T getAnnotation(Class<T> annoClass)
739 Annotation[] annos = getDeclaredAnnotations();
740 for (int i = 0; i < annos.length; ++i)
741 if (annos[i].annotationType() == annoClass)
746 public Annotation[] getDeclaredAnnotations()
748 Annotation[] result = getDeclaredAnnotationsInternal();
750 result = new Annotation[0];
754 private native Annotation[] getDeclaredAnnotationsInternal();
757 * Return the String in the Signature attribute for this field. If there
758 * is no Signature attribute, return null.
760 private native String getSignature();
762 native void setByte (Class caller, Object obj, byte b, boolean checkFinal)
763 throws IllegalArgumentException, IllegalAccessException;
765 native void setShort (Class caller, Object obj, short s, boolean checkFinal)
766 throws IllegalArgumentException, IllegalAccessException;
768 native void setInt (Class caller, Object obj, int i, boolean checkFinal)
769 throws IllegalArgumentException, IllegalAccessException;
771 native void setLong (Class caller, Object obj, long l, boolean checkFinal)
772 throws IllegalArgumentException, IllegalAccessException;
774 native void setFloat (Class caller, Object obj, float f, boolean checkFinal)
775 throws IllegalArgumentException, IllegalAccessException;
777 native void setDouble (Class caller, Object obj, double d,
779 throws IllegalArgumentException, IllegalAccessException;
781 native void setChar (Class caller, Object obj, char c, boolean checkFinal)
782 throws IllegalArgumentException, IllegalAccessException;
784 native void setBoolean (Class caller, Object obj, boolean b,
786 throws IllegalArgumentException, IllegalAccessException;
788 native void set (Class caller, Object obj, Object val, Class type,
790 throws IllegalArgumentException, IllegalAccessException;
792 private void set (Class caller, Object object, Object value)
793 throws IllegalArgumentException, IllegalAccessException
795 Class type = getType();
796 if (! type.isPrimitive())
797 set(caller, object, value, type, true);
798 else if (value instanceof Byte)
799 setByte(caller, object, ((Byte) value).byteValue(), true);
800 else if (value instanceof Short)
801 setShort (caller, object, ((Short) value).shortValue(), true);
802 else if (value instanceof Integer)
803 setInt(caller, object, ((Integer) value).intValue(), true);
804 else if (value instanceof Long)
805 setLong(caller, object, ((Long) value).longValue(), true);
806 else if (value instanceof Float)
807 setFloat(caller, object, ((Float) value).floatValue(), true);
808 else if (value instanceof Double)
809 setDouble(caller, object, ((Double) value).doubleValue(), true);
810 else if (value instanceof Character)
811 setChar(caller, object, ((Character) value).charValue(), true);
812 else if (value instanceof Boolean)
813 setBoolean(caller, object, ((Boolean) value).booleanValue(), true);
815 throw new IllegalArgumentException();