本文整理了Java中org.powermock.reflect.internal.WhiteboxImpl.findField()
方法的一些代码示例,展示了WhiteboxImpl.findField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteboxImpl.findField()
方法的具体详情如下:
包路径:org.powermock.reflect.internal.WhiteboxImpl
类名称:WhiteboxImpl
方法名:findField
[英]Find field.
[中]找到菲尔德。
代码示例来源:origin: org.powermock/powermock-reflect
/**
* 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) {
setField(object, value, findField(object, new AssignableFromFieldTypeMatcherStrategy(getType(value)), where));
}
代码示例来源:origin: org.powermock.reflect/powermock-reflect
/**
* 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) {
setField(object, value, findField(object, new AssignableFromFieldTypeMatcherStrategy(getType(value)), where));
}
内容来源于网络,如有侵权,请联系作者删除!