List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:io.fabric8.api.registry.ApiFinder.java
public static boolean booleanAttribute(Map map, String propertyName) { Object value = map.get(propertyName); if (value instanceof Boolean) { Boolean b = (Boolean) value; return b.booleanValue(); } else {//from w w w .j a va2 s. co m return false; } }
From source file:Main.java
/** * <p>Converts a Boolean to a boolean handling {@code null} * by returning {@code false}.</p> * * <pre>/*from w w w . ja v a 2 s .co m*/ * BooleanUtils.toBoolean(Boolean.TRUE) = true * BooleanUtils.toBoolean(Boolean.FALSE) = false * BooleanUtils.toBoolean(null) = false * </pre> * * @param bool the boolean to convert * @return {@code true} or {@code false}, {@code null} returns {@code false} */ public static boolean toBoolean(Boolean bool) { return bool != null && bool.booleanValue(); }
From source file:com.aurel.track.admin.customize.category.filter.MenuitemFilterBL.java
/** * Loads the filter names from property file * @return//from w w w. ja v a 2 s. co m */ private static List<String> loadFilterNamesToSubscribe() { List<String> filterNames = new LinkedList<String>(); String ON = "on"; String OFF = "off"; PropertiesConfiguration propertiesConfiguration = null; try { propertiesConfiguration = HandleHome.getProperties(HandleHome.FILTER_SUBSCRIPTIONS_FILE, ApplicationBean.getInstance().getServletContext()); } catch (ServletException e) { LOGGER.error( "ServletException by getting the FilterSubscriptions.properties from war " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (propertiesConfiguration != null) { Iterator<String> keys = propertiesConfiguration.getKeys(); while (keys.hasNext()) { String key = keys.next(); String[] keyParts = key.split("\\."); if (keyParts != null && keyParts.length > 1) { String repository = keyParts[0]; if (repository != null && !"".equals(repository)) { String filterName = key.substring(repository.length() + 1); String value = propertiesConfiguration.getString(key); if (value != null && !"".equals(value)) { if (ON.equals(value)) { filterNames.add(filterName); } else { if (!OFF.equals(value)) { try { Boolean boolValue = Boolean.valueOf(value); if (boolValue != null && boolValue.booleanValue()) { filterNames.add(filterName); } } catch (Exception e) { LOGGER.info("The value " + value + " for key " + key + " can't be converted to a boolean " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } } } } } } return filterNames; }
From source file:org.jodconverter.cli.Convert.java
private static final Map<String, Object> toMap(final String[] options) { if (options == null || options.length == 0 || options.length % 2 != 0) { return null; }/*from ww w. java 2s .c o m*/ return IntStream.range(0, options.length).filter(i -> i % 2 == 0).boxed() .collect(Collectors.toMap(i -> options[i], i -> { final String val = options[i + 1]; final Boolean bool = BooleanUtils.toBooleanObject(val); if (bool != null) { return bool.booleanValue(); } try { return Integer.parseInt(val); } catch (NumberFormatException nfe) { return val; } })); }
From source file:com.meetup.memcached.NativeHandler.java
protected static byte[] encode(Boolean value) { byte[] b = new byte[1]; if (value.booleanValue()) b[0] = 1;/* w w w . j av a 2 s. c om*/ else b[0] = 0; return b; }
From source file:Main.java
/** * <p>Converts an array of object Booleans to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Boolean} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code boolean} array, {@code null} if null array input *///from w w w. j a v a 2 s . c o m public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BOOLEAN_ARRAY; } final boolean[] result = new boolean[array.length]; for (int i = 0; i < array.length; i++) { Boolean b = array[i]; result[i] = (b == null ? valueForNull : b.booleanValue()); } return result; }
From source file:Main.java
/** * <p>Converts a Boolean to a boolean handling {@code null} * by returning {@code false}.</p> * * <pre>//w w w . j a v a2s . c o m * BooleanUtils.toBoolean(Boolean.TRUE) = true * BooleanUtils.toBoolean(Boolean.FALSE) = false * BooleanUtils.toBoolean(null) = false * </pre> * * @param bool the boolean to convert * @return {@code true} or {@code false}, {@code null} returns {@code false} */ public static boolean toBoolean(final Boolean bool) { return bool != null && bool.booleanValue(); }
From source file:Main.java
/** * <p>Converts an array of object Booleans to primitives handling {@code null}.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array a {@code Boolean} array, may be {@code null} * @param valueForNull the value to insert if {@code null} found * @return a {@code boolean} array, {@code null} if null array input *///from w ww . j av a 2 s . c om public static boolean[] toPrimitive(final Boolean[] array, final boolean valueForNull) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_BOOLEAN_ARRAY; } final boolean[] result = new boolean[array.length]; for (int i = 0; i < array.length; i++) { final Boolean b = array[i]; result[i] = (b == null ? valueForNull : b.booleanValue()); } return result; }
From source file:com.ikanow.aleph2.distributed_services.utils.KafkaUtils.java
/** Checks if a topic exists, caches the result * @param topic/*from www . j a v a2 s.c om*/ * @return */ public static boolean doesTopicExist(final String topic, final ZkUtils zk_client) { Boolean does_topic_exist = my_topics.get(topic); if (null != does_topic_exist) { return does_topic_exist.booleanValue(); } does_topic_exist = known_topics.getIfPresent(topic); if (null != does_topic_exist) { return does_topic_exist.booleanValue(); } final boolean topic_exists = AdminUtils.topicExists(zk_client, topic); known_topics.put(topic, topic_exists); return topic_exists; }
From source file:net.java.sip.communicator.impl.osdependent.jdic.TrayMenuFactory.java
/** * Creates a tray menu for the given system tray. * * @param tray the system tray for which we're creating a menu * @param swing indicates if we should create a Swing or an AWT menu * @return a tray menu for the given system tray (first) and the default * menu item (second)//from w w w . jav a2s .c om */ public static Pair<Object, Object> createTrayMenu(SystrayServiceJdicImpl tray, boolean swing, boolean accountMenuSupported) { final Object trayMenu = swing ? new JPopupMenu() : new PopupMenu(); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { TrayMenuFactory.actionPerformed(event); } }; Boolean showOptions = OsDependentActivator.getConfigurationService() .getBoolean("net.java.sip.communicator.impl.gui.main.configforms." + "SHOW_OPTIONS_WINDOW", true); if (showOptions.booleanValue()) { add(trayMenu, createTrayMenuItem("settings", (OSUtils.IS_MAC) ? "service.gui.PREFERENCES" : "service.gui.SETTINGS", "service.systray.CONFIGURE_ICON", listener, swing)); } add(trayMenu, createTrayMenuItem("addContact", "service.gui.ADD_CONTACT", "service.gui.icons.ADD_CONTACT_16x16_ICON", listener, swing)); addSeparator(trayMenu); Boolean chatPresenceDisabled = OsDependentActivator.getConfigurationService() .getBoolean("net.java.sip.communicator.impl.gui.main.presence." + "CHAT_PRESENCE_DISABLED", false); if (!chatPresenceDisabled.booleanValue() && accountMenuSupported) { add(trayMenu, new StatusSubMenu(swing, accountMenuSupported).getMenu()); addSeparator(trayMenu); } String showHideName; String showHideTextId; String showHideIconId; if (OsDependentActivator.getUIService().isVisible()) { showHideName = "service.gui.HIDE"; showHideTextId = "service.gui.HIDE"; showHideIconId = "service.gui.icons.SEARCH_ICON_16x16"; } else { showHideName = "service.gui.SHOW"; showHideTextId = "service.gui.SHOW"; showHideIconId = "service.gui.icons.SEARCH_ICON_16x16"; } final Object showHideMenuItem = createTrayMenuItem(showHideName, showHideTextId, showHideIconId, listener, swing); add(trayMenu, showHideMenuItem); add(trayMenu, createTrayMenuItem("service.gui.QUIT", "service.gui.QUIT", "service.systray.QUIT_MENU_ICON", listener, swing)); OsDependentActivator.getUIService().addWindowListener(new WindowAdapter() { /** * Invoked when a window is activated. */ @Override public void windowActivated(WindowEvent e) { changeTrayMenuItem(showHideMenuItem, "service.gui.HIDE", "service.gui.HIDE", "service.gui.icons.SEARCH_ICON_16x16"); } /** * Invoked when a window is de-activated. */ @Override public void windowDeactivated(WindowEvent e) { changeTrayMenuItem(showHideMenuItem, "service.gui.SHOW", "service.gui.SHOW", "service.gui.icons.SEARCH_ICON_16x16"); } }); return Pair.of(trayMenu, showHideMenuItem); }