Here you can find the source of setFieldValue(Object pojo, Field field, Object value)
Parameter | Description |
---|---|
pojo | a parameter |
field | a parameter |
value | a parameter |
Parameter | Description |
---|---|
SecurityException | an exception |
NoSuchFieldException | an exception |
IllegalArgumentException | an exception |
IllegalAccessException | an exception |
public static void setFieldValue(Object pojo, Field field, Object value) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; public class Main { /**// ww w . j a va2 s . co m * * @param pojo * @param field * @param value * @throws SecurityException * @throws NoSuchFieldException * @throws IllegalArgumentException * @throws IllegalAccessException */ public static void setFieldValue(Object pojo, Field field, Object value) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { field.setAccessible(true); field.set(pojo, value); } }