首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

java 调用父类的 私有步骤

2012-10-07 
java 调用父类的 私有方法protected void setActionsActivated(boolean state) {Method method nulltry

java 调用父类的 私有方法

protected void setActionsActivated(boolean state) {

Method method= null;

try {

method= AbstractTextEditor.class.getDeclaredMethod("setActionActivation", new Class[] { boolean.class }); //$NON-NLS-1$

} catch (SecurityException ex) {

JavaPlugin.log(ex);

} catch (NoSuchMethodException ex) {

JavaPlugin.log(ex);

}

Assert.isNotNull(method);

method.setAccessible(true);

try {

method.invoke(this, new Object[] { new Boolean(state) });

} catch (IllegalArgumentException ex) {

JavaPlugin.log(ex);

} catch (InvocationTargetException ex) {

JavaPlugin.log(ex);

} catch (IllegalAccessException ex) {

JavaPlugin.log(ex);

}

}

热点排行