當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。