Java Reflection Field Set setField(Object item, Field f, Object value)

Here you can find the source of setField(Object item, Field f, Object value)

Description

set Field

License

Open Source License

Declaration

private static void setField(Object item, Field f, Object value) 

Method Source Code

//package com.java2s;
// modify it under the terms of the GNU General Public License

import java.lang.reflect.Field;

public class Main {
    private static void setField(Object item, Field f, Object value) {
        try {/*from ww w  . j a  va  2 s .  c o  m*/
            f.setAccessible(true);
            f.set(item, value);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related

  1. setField(final Object parent, final String name, final Object obj)
  2. setField(java.lang.Object toObj, String tcFieldName, java.lang.Object toNewValue)
  3. setField(Object instance, String fieldName, Object value)
  4. setField(Object instance, String name, Object obj)
  5. setField(Object instance, String sField, Object value)
  6. setField(Object o, String fieldName, Object inject)
  7. setField(Object o, String fieldName, Object value)
  8. setField(Object o, String fieldName, Object value)
  9. setField(Object o, String name, Object value)