/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object the object to modify * @param fieldName the name of the field * @param value the new value of the field */ public static void setInternalState(Object object, String fieldName, Object[] value) { setInternalState(object, fieldName, (Object) value); }
/** * Register a proxy framework. * * @param proxyFramework * The proxy framework to register. */ public static void registerProxyFramework(ProxyFramework proxyFramework) { WhiteboxImpl.setInternalState(WhiteboxImpl.class, proxyFramework); } }
/** * Set the value of a field using reflection at at specific place in the * class hierarchy (<tt>where</tt>). This first field assignable to * <tt>object</tt> will then be set to <tt>value</tt>. * * @param object * the object to modify * @param value * the new value of the field * @param where * the class in the hierarchy where the field is defined */ public static void setInternalState(Object object, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, value, where); }
/** * Set an array value of a field using reflection. This method will traverse * the super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object * the object to modify * @param fieldName * the name of the field * @param value * the new value of the field */ public static void setInternalState(Object object, String fieldName, Object[] value) { WhiteboxImpl.setInternalState(object, fieldName, value); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until the first field of type <tt>fieldType</tt> is * found. The <tt>value</tt> will then be assigned to this field. * * @param object * the object to modify * @param fieldType * the type of the field * @param value * the new value of the field */ public static void setInternalState(Object object, Class<?> fieldType, Object value) { WhiteboxImpl.setInternalState(object, fieldType, value); }
/** * Set the value of a field using reflection at at specific place in the * class hierarchy (<tt>where</tt>). This first field assignable to * <tt>object</tt> will then be set to <tt>value</tt>. * * @param object * the object to modify * @param value * the new value of the field * @param where * the class in the hierarchy where the field is defined */ public static void setInternalState(Object object, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, value, where); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object * the object to modify * @param fieldName * the name of the field * @param value * the new value of the field */ public static void setInternalState(Object object, String fieldName, Object[] value) { setInternalState(object, fieldName, (Object) value); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object * the object whose field to modify * @param fieldName * the name of the field * @param value * the new value of the field */ public static void setInternalState(Object object, String fieldName, Object value) { WhiteboxImpl.setInternalState(object, fieldName, value); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until the first field of type <tt>fieldType</tt> is * found. The <tt>value</tt> will then be assigned to this field. * * @param object * the object to modify * @param fieldType * the type of the field * @param value * the new value of the field */ public static void setInternalState(Object object, Class<?> fieldType, Object value) { WhiteboxImpl.setInternalState(object, fieldType, value); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object * the object whose field to modify * @param fieldName * the name of the field * @param value * the new value of the field */ public static void setInternalState(Object object, String fieldName, Object value) { WhiteboxImpl.setInternalState(object, fieldName, value); }
/** * Set an array value of a field using reflection. This method will traverse * the super class hierarchy until a field with name <tt>fieldName</tt> is * found. * * @param object * the object to modify * @param fieldName * the name of the field * @param value * the new value of the field */ public static void setInternalState(Object object, String fieldName, Object[] value) { WhiteboxImpl.setInternalState(object, fieldName, value); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until the first field assignable to the * <tt>value</tt> type is found. The <tt>value</tt> (or * <tt>additionaValues</tt> if present) will then be assigned to this field. * * @param object * the object to modify * @param value * the new value of the field * @param additionalValues * Additional values to set on the object */ public static void setInternalState(Object object, Object value, Object... additionalValues) { WhiteboxImpl.setInternalState(object, value, additionalValues); }
/** * Set the value of a field using reflection. This method will traverse the * super class hierarchy until the first field assignable to the * <tt>value</tt> type is found. The <tt>value</tt> (or * <tt>additionaValues</tt> if present) will then be assigned to this field. * * @param object * the object to modify * @param value * the new value of the field * @param additionalValues * Additional values to set on the object */ public static void setInternalState(Object object, Object value, Object... additionalValues) { WhiteboxImpl.setInternalState(object, value, additionalValues); }
/** * Set the value of a field using reflection. Use this method when you need * to specify in which class the field is declared. This might be useful * when you have mocked the instance you are trying to modify. * * @param object * the object to modify * @param fieldName * the name of the field * @param value * the new value of the field * @param where * the class in the hierarchy where the field is defined */ public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, fieldName, value, where); }
/** * Set the value of a field using reflection. Use this method when you need * to specify in which class the field is declared. This might be useful * when you have mocked the instance you are trying to modify. * * @param object * the object to modify * @param fieldName * the name of the field * @param value * the new value of the field * @param where * the class in the hierarchy where the field is defined */ public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, fieldName, value, where); }
/** * Set the value of a field using reflection at a specific location ( * <tt>where</tt>) in the class hierarchy. The <tt>value</tt> will then be * assigned to this field. The first field matching the <tt>fieldType</tt> * in the hierarchy will be set. * * @param object * the object to modify * @param fieldType * the type of the field the should be set. * @param value * the new value of the field * @param where * which class in the hierarchy defining the field */ public static void setInternalState(Object object, Class<?> fieldType, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, fieldType, value, where); }
/** * Set the value of a field using reflection at a specific location ( * <tt>where</tt>) in the class hierarchy. The <tt>value</tt> will then be * assigned to this field. The first field matching the <tt>fieldType</tt> * in the hierarchy will be set. * * @param object * the object to modify * @param fieldType * the type of the field the should be set. * @param value * the new value of the field * @param where * which class in the hierarchy defining the field */ public static void setInternalState(Object object, Class<?> fieldType, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, fieldType, value, where); }
try { final boolean isStaticField = Modifier.isStatic(field.getModifiers()); setInternalState(isStaticField ? getType(object) : object, field.getType(), field.get(context)); } catch (FieldNotFoundException e) { if (strategy == FieldMatchingStrategy.STRICT) {
try { final boolean isStaticField = Modifier.isStatic(field.getModifiers()); setInternalState(isStaticField ? getType(object) : object, field.getType(), field.get(context)); } catch (FieldNotFoundException e) { if (strategy == FieldMatchingStrategy.STRICT) {