当前位置: 首页>>代码示例>>Java>>正文


Java Field.setBoolean方法代码示例

本文整理汇总了Java中java.lang.reflect.Field.setBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Field.setBoolean方法的具体用法?Java Field.setBoolean怎么用?Java Field.setBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.reflect.Field的用法示例。


在下文中一共展示了Field.setBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyPrivateDataInto

import java.lang.reflect.Field; //导入方法依赖的package包/类
/**
 * Copies all private data from this event into that.
 * Space is allocated for the copied data that will be
 * freed when the that is finalized. Upon completion,
 * this event is not changed.
 */
void copyPrivateDataInto(AWTEvent that) {
    that.bdata = this.bdata;
    // Copy canAccessSystemClipboard value from this into that.
    if (this instanceof InputEvent && that instanceof InputEvent) {
        Field field = get_InputEvent_CanAccessSystemClipboard();
        if (field != null) {
            try {
                boolean b = field.getBoolean(this);
                field.setBoolean(that, b);
            } catch(IllegalAccessException e) {
                if (log.isLoggable(PlatformLogger.Level.FINE)) {
                    log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e);
                }
            }
        }
    }
    that.isSystemGenerated = this.isSystemGenerated;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:AWTEvent.java

示例2: onCreate

import java.lang.reflect.Field; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    actionBar = getSupportActionBar();

    // Hack. Forcing overflow button on actionbar on devices with hardware menu button
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception ex) {
        // Ignore
    }
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:19,代码来源:CoreBaseActivity.java

示例3: setValue

import java.lang.reflect.Field; //导入方法依赖的package包/类
public void setValue(boolean value) {
    this.value = value;
    Field[] arrfield = this.mod.getClass().getDeclaredFields();
    int n = arrfield.length;
    int n2 = 0;
    while (n2 < n) {
        Field field = arrfield[n2];
        field.setAccessible(true);
        if (field.isAnnotationPresent(Op.class) && field.getName().equalsIgnoreCase(this.name)) {
            try {
                field.setBoolean(this.mod, value);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
        ++n2;
    }
    if (Gui.instance != null) {
        Gui.instance.reloadOptions();
    }
    OptionManager.save();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:Option.java

示例4: setValueHard

import java.lang.reflect.Field; //导入方法依赖的package包/类
public void setValueHard(boolean value) {
    this.value = value;
    Field[] arrfield = this.mod.getClass().getDeclaredFields();
    int n = arrfield.length;
    int n2 = 0;
    while (n2 < n) {
        Field field = arrfield[n2];
        field.setAccessible(true);
        if (field.isAnnotationPresent(Op.class) && field.getName().equalsIgnoreCase(this.name)) {
            try {
                field.setBoolean(this.mod, value);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
        ++n2;
    }
    if (Gui.instance != null) {
        Gui.instance.reloadOptions();
    }
    OptionManager.save();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:Option.java

示例5: NametagEntity

import java.lang.reflect.Field; //导入方法依赖的package包/类
public NametagEntity(final Player player)
{
    super(((CraftWorld)player.getWorld()).getHandle());
    final Location location = player.getLocation();
    this.setInvisible(true);
    this.setPosition(location.getX(), location.getY(), location.getZ());
    try {
        final Field invulnerable = Entity.class.getDeclaredField("invulnerable");
        invulnerable.setAccessible(true);
        invulnerable.setBoolean(this, true);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    this.world.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
    this.persistent = true;
    this.hideTag(player);
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:19,代码来源:NametagEntity.java

示例6: disableShiftMode

import java.lang.reflect.Field; //导入方法依赖的package包/类
/**
 * 取消BottomNavigationView各item切换时的位移动效
 *
 * @param navigationView 底部导航栏视图
 */
public static void disableShiftMode(BottomNavigationView navigationView) {

    BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
    try {
        Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
        shiftingMode.setAccessible(true);
        shiftingMode.setBoolean(menuView, false);
        shiftingMode.setAccessible(false);

        for (int i = 0; i < menuView.getChildCount(); i++) {
            BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
            itemView.setShiftingMode(false);
            itemView.setChecked(itemView.getItemData().isChecked());
        }

    } catch (NoSuchFieldException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Implementist,项目名称:iReading,代码行数:25,代码来源:CommonUtils.java

示例7: dispatched

import java.lang.reflect.Field; //导入方法依赖的package包/类
void dispatched() {
    if (this instanceof InputEvent) {
        Field field = get_InputEvent_CanAccessSystemClipboard();
        if (field != null) {
            try {
                field.setBoolean(this, false);
            } catch(IllegalAccessException e) {
                if (log.isLoggable(PlatformLogger.Level.FINE)) {
                    log.fine("AWTEvent.dispatched() got IllegalAccessException ", e);
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AWTEvent.java

示例8: forceShowOverflowMenu

import java.lang.reflect.Field; //导入方法依赖的package包/类
public static void forceShowOverflowMenu(Context context) {
	try {
		ViewConfiguration config = ViewConfiguration.get(context);
		Field menuKeyField = ViewConfiguration.class.
				getDeclaredField("sHasPermanentMenuKey");
		if (menuKeyField != null) {
			menuKeyField.setAccessible(true);
			menuKeyField.setBoolean(config, false);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:14,代码来源:Utils.java

示例9: hookLayoutInflater

import java.lang.reflect.Field; //导入方法依赖的package包/类
private void hookLayoutInflater(Context context) {
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    try {
        Field field = LayoutInflater.class.getDeclaredField("mFactorySet");
        field.setAccessible(true);
        field.setBoolean(layoutInflater, false);
        LayoutInflaterCompat.setFactory2(layoutInflater, AndroidSkinFactory.from(context,layoutInflater));
    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:MeetYouDevs,项目名称:Android-Skin,代码行数:12,代码来源:AndroidSkinHook.java

示例10: onCreate

import java.lang.reflect.Field; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    // force to sow the overflow menu icon
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception ex) {
        // Ignore
    }
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:16,代码来源:MyApp.java

示例11: installLayoutFactory

import java.lang.reflect.Field; //导入方法依赖的package包/类
private void installLayoutFactory(Context context) {
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    try {
        Field field = LayoutInflater.class.getDeclaredField("mFactorySet");
        field.setAccessible(true);
        field.setBoolean(layoutInflater, false);
        LayoutInflaterCompat.setFactory(layoutInflater, getSkinDelegate(context));
    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:12,代码来源:SkinActivityLifecycle.java

示例12: maybeDisableExportControls

import java.lang.reflect.Field; //导入方法依赖的package包/类
public static void maybeDisableExportControls() {
    // This sorry story is documented in https://bugs.openjdk.java.net/browse/JDK-7024850
    // Oracle received permission to ship AES-256 by default in 2011, but didn't get around to it for Java 8
    // even though that shipped in 2014! That's dumb. So we disable the ridiculous US government mandated DRM
    // for AES-256 here, as Tor/BIP38 requires it.

    if (done) return;
    done = true;

    if (Utils.isAndroidRuntime())
        return;
    try {
        Field gate = Class.forName("javax.crypto.JceSecurity").getDeclaredField("isRestricted");
        gate.setAccessible(true);
        gate.setBoolean(null, false);
        final Field allPerm = Class.forName("javax.crypto.CryptoAllPermission").getDeclaredField("INSTANCE");
        allPerm.setAccessible(true);
        Object accessAllAreasCard = allPerm.get(null);
        final Constructor<?> constructor = Class.forName("javax.crypto.CryptoPermissions").getDeclaredConstructor();
        constructor.setAccessible(true);
        Object coll = constructor.newInstance();
        Method addPerm = Class.forName("javax.crypto.CryptoPermissions").getDeclaredMethod("add", java.security.Permission.class);
        addPerm.setAccessible(true);
        addPerm.invoke(coll, accessAllAreasCard);
        Field defaultPolicy = Class.forName("javax.crypto.JceSecurity").getDeclaredField("defaultPolicy");
        defaultPolicy.setAccessible(true);
        defaultPolicy.set(null, coll);
    } catch (Exception e) {
        log.warn("Failed to deactivate AES-256 barrier logic, Tor mode/BIP38 decryption may crash if this JVM requires it: " + e.getMessage());
    }
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:32,代码来源:DRMWorkaround.java

示例13: setAutomaticRefreshEnabled

import java.lang.reflect.Field; //导入方法依赖的package包/类
private void setAutomaticRefreshEnabled (boolean flag) throws Exception {
    Field f = FilesystemInterceptor.class.getDeclaredField("AUTOMATIC_REFRESH_ENABLED");
    f.setAccessible(true);
    f.setBoolean(FilesystemInterceptor.class, flag);
    assert ((Boolean) f.get(FilesystemInterceptor.class)).equals(flag);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:StatusTest.java

示例14: testFix217212_ActivatePanel

import java.lang.reflect.Field; //导入方法依赖的package包/类
public void testFix217212_ActivatePanel() throws Exception {
    InstanceContent ic = new InstanceContent();
    GlobalLookup4TestImpl nodesLkp = new GlobalLookup4TestImpl(ic);
    UnitTestUtils.prepareTest(new String[]{
                "/META-INF/generated-layer.xml"},
            Lookups.singleton(nodesLkp));

    TestLookupHint hint = new TestLookupHint("annotation/tester");
    ic.add(hint);

    final NavigatorTC navTC = NavigatorTC.getInstance();
    Field field = NavigatorController.class.getDeclaredField("updateWhenNotShown");
    field.setAccessible(true);
    field.setBoolean(navTC.getController(), true);
    try {
        Mutex.EVENT.readAccess(new Mutex.ExceptionAction() {
            @Override
            public Object run() throws Exception {
                navTC.getController().propertyChange(
                        new PropertyChangeEvent(navTC, TopComponent.Registry.PROP_TC_OPENED, null, navTC));
                return null;
            }
        });
        waitForProviders(navTC);
        NavigatorPanel selPanel = navTC.getSelectedPanel();
        assertNotNull("Selected panel is null", selPanel);

        List<? extends NavigatorPanel> panels = navTC.getPanels();
        assertEquals(2, panels.size());

        NavigatorPanel lazyPanel1 = panels.get(0);
        Method method = LazyPanel.class.getDeclaredMethod("initialize");
        method.setAccessible(true);
        NavigatorPanel delegate1 = (NavigatorPanel) method.invoke(lazyPanel1);

        NavigatorPanel lazyPanel2 = panels.get(1);
        method = LazyPanel.class.getDeclaredMethod("initialize");
        method.setAccessible(true);
        NavigatorPanel delegate2 = (NavigatorPanel) method.invoke(lazyPanel2);

        System.out.println("selected panel before: " + selPanel.getDisplayName());

        //find not-selected panel
        final NavigatorPanel toActivate;
        final NavigatorPanel toActivateLazy;
        if (selPanel.equals(lazyPanel1)) {
            toActivate = delegate2;
            toActivateLazy = lazyPanel2;
        } else {
            toActivate = delegate1;
            toActivateLazy = lazyPanel1;

        }

        Mutex.EVENT.readAccess(new Mutex.ExceptionAction() {
            @Override
            public Object run() throws Exception {
                NavigatorHandler.activatePanel(toActivate);
                return null;
            }
        });

        assertTrue(selPanel != navTC.getSelectedPanel());
        assertTrue(toActivateLazy == navTC.getSelectedPanel());

        System.out.println("selected panel after: " + navTC.getSelectedPanel().getDisplayName());
    } finally {
        navTC.getController().propertyChange(
                new PropertyChangeEvent(navTC, TopComponent.Registry.PROP_TC_CLOSED, null, navTC));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:72,代码来源:NavigatorPanelWithToolbarTest.java

示例15: toggleEnabled

import java.lang.reflect.Field; //导入方法依赖的package包/类
private void toggleEnabled(String fieldName, boolean value) throws NoSuchFieldException, IllegalAccessException {
    Field cthField = null;
    cthField = TextInputLayout.class.getDeclaredField(fieldName);
    cthField.setAccessible(true);
    cthField.setBoolean(this, value);
}
 
开发者ID:KingsMentor,项目名称:Luhn,代码行数:7,代码来源:CardTextInputLayout.java


注:本文中的java.lang.reflect.Field.setBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。