List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:com.evolveum.midpoint.model.impl.util.Utils.java
public static boolean isDryRun(Task task) throws SchemaException { Validate.notNull(task, "Task must not be null."); if (task.getExtension() == null) { return false; }// ww w.j a v a2 s.c o m PrismProperty<Boolean> item = task.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_DRY_RUN); if (item == null || item.isEmpty()) { return false; } if (item.getValues().size() > 1) { throw new SchemaException("Unexpected number of values for option 'dry run'."); } Boolean dryRun = item.getValues().iterator().next().getValue(); if (dryRun == null) { return false; } return dryRun.booleanValue(); }
From source file:it.govpay.web.handler.MessageLoggingHandlerUtils.java
@SuppressWarnings("unchecked") public static boolean logToSystemOut(SOAPMessageContext smc, String tipoServizio, int versioneServizio, Logger log) {// w ww.jav a 2 s . co m Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); GpContext ctx = null; Message msg = new Message(); SOAPMessage message = smc.getMessage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { message.writeTo(baos); msg.setContent(baos.toByteArray()); } catch (Exception e) { log.error("Exception in handler: " + e); } Map<String, List<String>> httpHeaders = null; if (outboundProperty.booleanValue()) { ctx = GpThreadLocal.get(); httpHeaders = (Map<String, List<String>>) smc.get(MessageContext.HTTP_RESPONSE_HEADERS); msg.setType(MessageType.RESPONSE_OUT); ctx.getContext().getResponse().setOutDate(new Date()); ctx.getContext().getResponse().setOutSize(Long.valueOf(baos.size())); } else { try { ctx = new GpContext(smc, tipoServizio, versioneServizio); ThreadContext.put("op", ctx.getTransactionId()); GpThreadLocal.set(ctx); } catch (Exception e) { log.error(e.getMessage(), e); return false; } httpHeaders = (Map<String, List<String>>) smc.get(MessageContext.HTTP_REQUEST_HEADERS); msg.setType(MessageType.REQUEST_IN); msg.setContentType(((HttpServletRequest) smc.get(MessageContext.SERVLET_REQUEST)).getContentType()); ctx.getContext().getRequest().setInDate(new Date()); ctx.getContext().getRequest().setInSize(Long.valueOf(baos.size())); } if (httpHeaders != null) { for (String key : httpHeaders.keySet()) { if (httpHeaders.get(key) != null) { if (key == null) msg.addHeader(new Property("Status-line", httpHeaders.get(key).get(0))); else if (httpHeaders.get(key).size() == 1) msg.addHeader(new Property(key, httpHeaders.get(key).get(0))); else msg.addHeader(new Property(key, ArrayUtils.toString(httpHeaders.get(key)))); } } } ctx.log(msg); return true; }
From source file:Main.java
public static boolean isMeizuSecurity(Context context) { if (!isSecVer(context)) { return false; }/*from w w w .jav a 2s . c o m*/ Boolean valueOf = Boolean.valueOf(false); try { Boolean bool; Class cls = Class.forName("android.os.Build"); Field field = cls.getField("MeizuSecurity"); field.setAccessible(true); bool = (Boolean) field.get(cls); return bool; } catch (SecurityException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (Error e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return valueOf.booleanValue(); }
From source file:net.minecraftforge.common.crafting.CraftingHelper.java
public static boolean findFiles(ModContainer mod, String base, Function<Path, Boolean> preprocessor, BiFunction<Path, Path, Boolean> processor) { FileSystem fs = null;/*from w w w . j ava 2 s . com*/ try { File source = mod.getSource(); if ("minecraft".equals(mod.getModId()) && DEBUG_LOAD_MINECRAFT) { try { URI tmp = CraftingManager.class.getResource("/assets/.mcassetsroot").toURI(); source = new File(tmp.resolve("..").getPath()); } catch (URISyntaxException e) { FMLLog.log.error("Error finding Minecraft jar: ", e); return false; } } Path root = null; if (source.isFile()) { try { fs = FileSystems.newFileSystem(source.toPath(), null); root = fs.getPath("/" + base); } catch (IOException e) { FMLLog.log.error("Error loading FileSystem from jar: ", e); return false; } } else if (source.isDirectory()) { root = source.toPath().resolve(base); } if (root == null || !Files.exists(root)) return false; if (preprocessor != null) { Boolean cont = preprocessor.apply(root); if (cont == null || !cont.booleanValue()) return false; } if (processor != null) { Iterator<Path> itr = null; try { itr = Files.walk(root).iterator(); } catch (IOException e) { FMLLog.log.error("Error iterating filesystem for: {}", mod.getModId(), e); return false; } while (itr != null && itr.hasNext()) { Boolean cont = processor.apply(root, itr.next()); if (cont == null || !cont.booleanValue()) return false; } } return true; } finally { IOUtils.closeQuietly(fs); } }
From source file:de.innovationgate.webgate.api.WGFactory.java
/** * Returns true, if the current thread is the WGAPI event thread *//*from w w w . j a v a2s.c om*/ public static boolean isEventThread() { Boolean is = (Boolean) _isEventThread.get(); if (is != null) { return is.booleanValue(); } else { return false; } }
From source file:fr.landel.utils.commons.ObjectUtils.java
/** * Get the primitive value of an {@link Boolean}. If {@code value} is not * {@code null}, returns the primitive value of {@code value} otherwise returns * {@code defaultValue}//from w w w . j av a 2 s . com * * <pre> * boolean value1 = ObjectUtils.toPrimitive(Boolean.TRUE, false); // => value1 = true * boolean value2 = ObjectUtils.toPrimitive(Boolean.FALSE, true); // => value2 = false * boolean value3 = ObjectUtils.toPrimitive(null, false); // => value3 = false * </pre> * * @param value * the {@link Boolean} value * @param defaultValue * the default value * @return a primitive boolean * * @see BooleanUtils#isFalse(Boolean) * @see BooleanUtils#isTrue(Boolean) * @see BooleanUtils#isNotFalse(Boolean) * @see BooleanUtils#isNotTrue(Boolean) */ public static boolean toPrimitive(final Boolean value, final boolean defaultValue) { if (value == null) { return defaultValue; } else { return value.booleanValue(); } }
From source file:com.industrieit.ohr.OHRJavassister.java
private static boolean isAlreadyReifXXXXX(Class cl) { Boolean b = reifcache.get(cl); //PL.pl("jjjjjjjjjjjjj testing reif "+cl+" "+b); if (b != null) { return b.booleanValue(); }//from w w w. j a v a 2s .co m reifcache.put(cl, Boolean.TRUE); return true; /*for (Class c : cl.getInterfaces()) { //System.out.println("class "+c.getName()); if (c == OHReify.class) { //System.out.println("inside"); reifcache.put(cl, Boolean.TRUE); return true; } } reifcache.put(cl, Boolean.FALSE); return false;*/ }
From source file:com.aurel.track.fieldType.runtime.bl.AttributeValueBL.java
public static void setSpecificAttribute(TAttributeValueBean tAttributeValueBean, Object attribute, int valueType) { switch (valueType) { case ValueType.BOOLEAN: Boolean booleanAttribute = null; try {//from w w w.jav a 2 s.c o m booleanAttribute = (Boolean) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for boolean " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (booleanAttribute != null && booleanAttribute.booleanValue() == true) { tAttributeValueBean.setCharacterValue(BooleanFields.TRUE_VALUE); } else { tAttributeValueBean.setCharacterValue(BooleanFields.FALSE_VALUE); } break; case ValueType.CUSTOMOPTION: Integer customOptionAttribute = null; try { customOptionAttribute = (Integer) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for custom option " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setCustomOptionID(customOptionAttribute); break; case ValueType.DATE: case ValueType.DATETIME: Date dateAttribute = null; try { dateAttribute = (Date) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for date option " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setDateValue(dateAttribute); break; case ValueType.DOUBLE: Double doubleAttribute = null; try { doubleAttribute = (Double) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for double option " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setDoubleValue(doubleAttribute); break; case ValueType.INTEGER: case ValueType.EXTERNALID: Integer integerAttribute = null; try { integerAttribute = (Integer) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for value type " + valueType + " and integer option " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setIntegerValue(integerAttribute); break; case ValueType.LONGTEXT: String longTextAttribute = null; try { longTextAttribute = (String) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type longTextAttribute " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setLongTextValue(longTextAttribute); break; case ValueType.SYSTEMOPTION: Integer systemOptionAttribute = null; try { systemOptionAttribute = (Integer) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type for system option " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setSystemOptionID(systemOptionAttribute); break; case ValueType.TEXT: String shortTextAttribute = null; try { shortTextAttribute = (String) attribute; } catch (Exception e) { LOGGER.error("Wrong attribute type shortTextAttribute " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } tAttributeValueBean.setTextValue(shortTextAttribute); break; } }
From source file:com.projity.util.ClassUtils.java
public static boolean isObjectReadOnly(Object object) { if (object == null) return false; Boolean value = null; try {//from w ww . ja v a 2s . c o m Method m = object.getClass().getMethod("isReadOnly", getterParams); if (m != null) value = (Boolean) m.invoke(object, null); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } catch (NoSuchMethodException e) { } return value != null && value.booleanValue(); }
From source file:com.aurel.track.admin.projectCopy.ProjectCopyBL.java
private static boolean entitySelected(Map<Integer, Boolean> selectedEntitiesMap, int entityID) { if (selectedEntitiesMap == null) { return false; }/*w ww . j a v a2 s . c om*/ Boolean entitySelected = selectedEntitiesMap.get(entityID); if (entitySelected != null && entitySelected.booleanValue()) { return true; } return false; }