Lines Matching defs:field
51 void printFieldInfo(Field field) {
52 System.out.println("Field name is " + field.getName());
54 + field.getDeclaringClass().getName());
55 System.out.println(" Field type is " + field.getType().getName());
57 + Integer.toHexString(field.getModifiers()));
65 Field field = null;
67 field = target.getField("string1");
68 one = (String) field.get(instance);
70 field = target.getField("string2");
71 two = (String) field.get(instance);
73 field = target.getField("string3");
74 three = (String) field.get(instance);
107 Field field = target.getField("innerField");
109 int x = field.getInt(instance);
111 System.err.println("field get unexpectedly worked: " + x);
124 Field field = null;
178 field = target.getField("string1");
179 if (field.getDeclaringClass() != target)
181 printFieldInfo(field);
182 String strVal = (String) field.get(instance);
187 field.set(instance, new String("a new string"));
188 strVal = (String) field.get(instance);
194 field.set(instance, new Object());
204 field = target.getField("string4");
205 four = (String) field.get(instance);
217 field = target.getField("string3");
218 three = (String) field.get(this);
227 * Try setting a field to null.
230 field = target.getDeclaredField("string3");
231 field.set(instance, null);
237 field = target.getField("pubLong");
238 longVal = field.getLong(instance);
241 field.setLong(instance, 0x9988776655443322L);
242 longVal = field.getLong(instance);
247 field = target.getField("superInt");
248 if (field.getDeclaringClass() == target)
250 printFieldInfo(field);
251 int intVal = field.getInt(instance);
253 Integer boxedIntVal = (Integer) field.get(instance);
256 field.set(instance, new Integer(20202));
257 intVal = field.getInt(instance);
259 field.setShort(instance, (short)30303);
260 intVal = field.getInt(instance);
262 field.setInt(instance, 40404);
263 intVal = field.getInt(instance);
266 field.set(instance, new Long(123));
273 field.setLong(instance, 123);
280 field.set(instance, new String("abc"));
288 field.getShort(instance);
295 field = target.getField("superClassInt");
296 printFieldInfo(field);
297 int superClassIntVal = field.getInt(instance);
300 field = target.getField("staticDouble");
301 printFieldInfo(field);
302 double staticDoubleVal = field.getDouble(null);
306 field.getLong(instance);
315 field = target.getField("aPrivateInt");
316 printFieldInfo(field);
326 field = target.getField("constantString");
327 printFieldInfo(field);
328 String val = (String) field.get(instance);
332 field = target.getField("cantTouchThis");
333 printFieldInfo(field);
334 intVal = field.getInt(instance);
337 field.setInt(instance, 99);
342 intVal = field.getInt(instance);
345 System.out.println(" " + field + " accessible=" + field.isAccessible());
346 field.setAccessible(true);
347 System.out.println(" " + field + " accessible=" + field.isAccessible());
348 field.setInt(instance, 87); // exercise int version
349 intVal = field.getInt(instance);
351 field.set(instance, 88); // exercise Object version
352 intVal = field.getInt(instance);
447 Field[] fields = niuClass.getDeclaredFields();
450 Field field = niuClass.getField("staticField");
451 System.out.println("got field");
452 field.get(null);
453 System.out.println("read field value");
491 Field field;
493 field = Main.class.getField("dummy");
497 Type listType = field.getGenericType();
498 System.out.println("generic field: " + listType);
546 Field field1, field2;