本文整理汇总了Java中com.intellij.util.ReflectionUtil.resetField方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtil.resetField方法的具体用法?Java ReflectionUtil.resetField怎么用?Java ReflectionUtil.resetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ReflectionUtil
的用法示例。
在下文中一共展示了ReflectionUtil.resetField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testResetField
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
public void testResetField() throws Exception {
final Reset reset = new Reset();
ReflectionUtil.resetField(reset, String.class, "STRING");
assertNull(reset.STRING);
ReflectionUtil.resetField(reset, boolean.class, "BOOLEAN");
assertFalse(reset.BOOLEAN);
ReflectionUtil.resetField(reset, int.class, "INT");
assertEquals(0, reset.INT);
ReflectionUtil.resetField(reset, double.class, "DOUBLE");
assertEquals(0d, reset.DOUBLE);
ReflectionUtil.resetField(reset, float.class, "FLOAT");
assertEquals(0f, reset.FLOAT);
ReflectionUtil.resetField(Reset.class, String.class, "STATIC_STRING");
assertNull(Reset.STATIC_STRING);
}
示例2: hide
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
public void hide(boolean dispose) {
myPopup.hide();
Window wnd = getWindow();
if (wnd instanceof JWindow) {
JRootPane rootPane = ((JWindow)wnd).getRootPane();
if (rootPane != null) {
ReflectionUtil.resetField(rootPane, "clientProperties");
final Container cp = rootPane.getContentPane();
if (cp != null) {
cp.removeAll();
}
}
}
}
示例3: resetField
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private static void resetField(Object object, Class type, @NonNls String name) {
try {
ReflectionUtil.resetField(object, ReflectionUtil.findField(object.getClass(), type, name));
}
catch (Exception e) {
// Ignore
}
}
示例4: clearOwnFields
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
public static void clearOwnFields(@NotNull Object object) {
final Field[] all = object.getClass().getDeclaredFields();
for (Field each : all) {
if ((each.getModifiers() & (Modifier.FINAL | Modifier.STATIC)) > 0) continue;
ReflectionUtil.resetField(object, each);
}
}
示例5: cleanupClass
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private static void cleanupClass(Class<?> aClass) throws Exception {
ReflectionUtil.resetField(aClass, null, "ourInstance");
}
示例6: setVisible
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
@Override
public void setVisible(boolean b) {
super.setVisible(b);
if (!b) ReflectionUtil.resetField(this, "invoker");
}
示例7: fixJTextComponentMemoryLeak
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private static void fixJTextComponentMemoryLeak() {
final JTextComponent component = ReflectionUtil.getStaticFieldValue(JTextComponent.class, JTextComponent.class, "focusedComponent");
if (component != null && !component.isDisplayable()){
ReflectionUtil.resetField(JTextComponent.class, JTextComponent.class, "focusedComponent");
}
}