List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:info.donsun.core.utils.Values.java
/** * ??/*www .j a v a 2 s . c o m*/ * * @param obj * @param defaultValue ,null * @return */ public static boolean getBoolean(Object obj, boolean defaultValue) { Boolean bool = BooleanUtils.toBooleanObject(getString(obj)); return bool != null ? bool.booleanValue() : defaultValue; }
From source file:org.cleverbus.api.common.Constraints.java
/** * Assert a boolean expression, throwing {@code IllegalArgumentException} * if the test result is {@code false}./*from ww w . jav a 2 s . c o m*/ * @param expression a boolean expression * @param message the exception message to use if the assertion fails * @throws IllegalArgumentException if expression is {@code false} */ public static void isTrue(Boolean expression, String message) { notNull(expression, message); if (expression.booleanValue() != Boolean.TRUE) { throw new IllegalDataException(InternalErrorEnum.E109, message); } }
From source file:Main.java
/** * <p>Converts a Boolean to a String returning one of the input Strings.</p> * * <pre>/*from w w w.ja v a 2 s . c o m*/ * BooleanUtils.toString(Boolean.TRUE, "true", "false", null) = "true" * BooleanUtils.toString(Boolean.FALSE, "true", "false", null) = "false" * BooleanUtils.toString(null, "true", "false", null) = null; * </pre> * * @param bool the Boolean to check * @param trueString the String to return if {@code true}, may be {@code null} * @param falseString the String to return if {@code false}, may be {@code null} * @param nullString the String to return if {@code null}, may be {@code null} * @return one of the three input Strings */ public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) { if (bool == null) { return nullString; } return bool.booleanValue() ? trueString : falseString; }
From source file:Main.java
/** * <p>Converts a Boolean to an int specifying the conversion values.</p> * * <pre>/*from w w w . jav a 2 s.c o m*/ * BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2) = 1 * BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0 * BooleanUtils.toInteger(null, 1, 0, 2) = 2 * </pre> * * @param bool the Boolean to convert * @param trueValue the value to return if {@code true} * @param falseValue the value to return if {@code false} * @param nullValue the value to return if {@code null} * @return the appropriate value */ public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) { if (bool == null) { return nullValue; } return bool.booleanValue() ? trueValue : falseValue; }
From source file:org.cleverbus.api.common.Constraints.java
/** * Assert a boolean expression, throwing {@code IllegalArgumentException} * if the test result is {@code false}.//from w w w . j av a2 s. com * @param expression a boolean expression * @param message the exception message to use if the assertion fails * @param errorCode the internal error code * @throws IllegalArgumentException if expression is {@code false} */ public static void isTrue(Boolean expression, String message, ErrorExtEnum errorCode) { notNull(expression, message); if (expression.booleanValue() != Boolean.TRUE) { throw new IllegalDataException(errorCode, message); } }
From source file:name.martingeisse.phunky.runtime.variable.TypeConversionUtil.java
/** * This method is used when creating an array by setting an element in a non-array * variable. It takes the value currently stored in the variable, and checks * whether that value allows creating an array this way. * /*from w w w.j a v a 2s. co m*/ * @param value the value used in place of an array * @return true if the value can be overwritten by an implicitly constructed * array, false if not */ public static boolean valueCanBeOverwrittenByImplicitArrayConstruction(Object value) { if (value == null) { return true; } if (value instanceof Boolean) { Boolean b = (Boolean) value; return (b.booleanValue() == false); } return false; }
From source file:com.openappengine.utility.ObjectConverter.java
/** * Converts Boolean to Integer. If boolean value is TRUE, then return 1, else return 0. * @param value The Boolean to be converted. * @return The converted Integer value./*from www . j av a 2s . co m*/ */ public static Integer booleanToInteger(Boolean value) { return value.booleanValue() ? Integer.valueOf(1) : Integer.valueOf(0); }
From source file:com.microsoft.tfs.client.common.ui.helpers.EditorHelper.java
/** * Saves all dirty editors matching the given saveable filter. * * @param filter//from www . j a va 2s. c om * the {@link WorkbenchPartSaveableFilter} to use to determine if the * given workbench parts should be saved (not <code>null</code>) * * @return <code>true</code> if successful, <code>false</code> if the user * cancelled the command. */ public static boolean saveAllDirtyEditors(final WorkbenchPartSaveableFilter filter) { /* * Attempt to save all dirty editors. Eclipse 3.3+ offers "saveAll" * which allows us to pick an choose which dirty items will be saved. * Older versions of Eclipse only offer "saveAllEditors" which saves * every dirty editor. Pre-10.0 versions of Team Explorer used * "saveAllEditors" which remains as the fallback. * * As an additional headache, Eclipse 3.0 (RAD 6.0) does not have some * of the interface types the method uses, so we have to load those via * reflection before finding the "saveAll" method. */ final IWorkbench workbench = PlatformUI.getWorkbench(); boolean saveResult = false; boolean reflectionError = false; try { // Since Eclipse 3.1 final Class iShellProviderClass = CheckinControl.class.getClassLoader() .loadClass("org.eclipse.jface.window.IShellProvider"); //$NON-NLS-1$ // Since Eclipse 3.3 final Class iSaveableFilterClass = CheckinControl.class.getClassLoader() .loadClass("org.eclipse.ui.ISaveableFilter"); //$NON-NLS-1$ final Class[] parameters = new Class[4]; parameters[0] = iShellProviderClass; parameters[1] = IRunnableContext.class; parameters[2] = iSaveableFilterClass; parameters[3] = Boolean.TYPE; final Method m = workbench.getClass().getMethod("saveAll", parameters); //$NON-NLS-1$ final Object[] arguments = new Object[4]; arguments[0] = workbench.getActiveWorkbenchWindow(); arguments[1] = workbench.getActiveWorkbenchWindow(); arguments[2] = new WorkbenchPartSaveableFilterAdapter(filter); arguments[3] = Boolean.TRUE; try { final Boolean result = (Boolean) m.invoke(workbench, arguments); saveResult = result.booleanValue(); } catch (final Exception e) { saveResult = false; } } catch (final ClassNotFoundException e) { reflectionError = true; } catch (final NoSuchMethodException e) { reflectionError = true; } if (reflectionError) { saveResult = workbench.saveAllEditors(true); } return saveResult; }
From source file:jp.co.acroquest.endosnipe.perfdoctor.rule.RuleInstanceUtil.java
/** * ??true??????<br>/*from w w w .j a v a 2 s. c o m*/ * org.apache.commons.beanUtils.ConvertUtils??????<br> * Boolean?????????<br> * ????true??????????null??true?<br> * @param value * @return ?true????? */ protected static boolean checkEnabled(final String value) { if (StringUtils.isEmpty(value)) { return true; } Boolean b = (Boolean) ConvertUtils.convert(value, Boolean.TYPE); return b.booleanValue(); }
From source file:com.cyclopsgroup.waterview.web.taglib.FormTag.java
/** * @param context Jelly context//from w ww .j av a 2 s. c om * @return True if control is supposed to be displayed */ public static boolean isControlsHidden(JellyContext context) { Boolean b = (Boolean) context.getVariable(HIDE_CONTROLS); return b == null ? false : b.booleanValue(); }