本文整理汇总了Java中com.intellij.util.ReflectionUtil.getStaticFieldValue方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtil.getStaticFieldValue方法的具体用法?Java ReflectionUtil.getStaticFieldValue怎么用?Java ReflectionUtil.getStaticFieldValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ReflectionUtil
的用法示例。
在下文中一共展示了ReflectionUtil.getStaticFieldValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnsafe
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
@NotNull
public static Unsafe getUnsafe() {
Unsafe unsafe = ReflectionUtil.getStaticFieldValue(Unsafe.class, Unsafe.class, "theUnsafe");
if (unsafe == null) {
throw new RuntimeException("Could not find 'theUnsafe' field in the " + Unsafe.class);
}
return unsafe;
}
示例2: addStringsFromClassToStatics
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
public static void addStringsFromClassToStatics(@NotNull Class aClass) {
for (Field field : aClass.getDeclaredFields()) {
if ((field.getModifiers() & Modifier.STATIC) == 0) continue;
if ((field.getModifiers() & Modifier.PUBLIC) == 0) continue;
String typeName = ReflectionUtil.getStaticFieldValue(aClass, String.class, field.getName());
if (typeName != null) {
staticIntern(typeName);
}
}
}
示例3: getShutdownHooks
import com.intellij.util.ReflectionUtil; //导入方法依赖的package包/类
private Map<Thread, Thread> getShutdownHooks() {
Class clazz;
try {
clazz = Class.forName("java.lang.ApplicationShutdownHooks");
}
catch (ClassNotFoundException e) {
// we can ignore this one
return Collections.emptyMap();
}
return ReflectionUtil.getStaticFieldValue(clazz, Map.class, "hooks");
}
示例4: 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");
}
}