Example usage for java.lang Boolean TRUE

List of usage examples for java.lang Boolean TRUE

Introduction

In this page you can find the example usage for java.lang Boolean TRUE.

Prototype

Boolean TRUE

To view the source code for java.lang Boolean TRUE.

Click Source Link

Document

The Boolean object corresponding to the primitive value true .

Usage

From source file:Primitives.java

/**
 * Get a Boolean from a boolean, equivalent to the java 1.4 method
 * Boolean.valueOf(boolean)/*from  ww  w . j av  a 2 s  . c  om*/
 * 
 * @param value
 *          the boolean
 * @return the Boolean equivalent
 */
public static Boolean valueOf(boolean value) {
    if (value)
        return Boolean.TRUE;
    else
        return Boolean.FALSE;
}

From source file:Main.java

private static XMLEventReader getXMLEventReader(String filename) throws Exception {
    XMLInputFactory xmlif = null;
    XMLEventReader xmlr = null;/*w  ww  . j  a v  a 2  s  . c  o  m*/
    xmlif = XMLInputFactory.newInstance();
    xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
    xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
    xmlif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
    xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);

    FileInputStream fis = new FileInputStream(filename);
    xmlr = xmlif.createXMLEventReader(filename, fis);

    return xmlr;
}

From source file:com.dungnv.vfw5.base.utils.test.DateTimeUtilsTest.java

@Test
public void getSysdate() throws Exception {
    String nowTime = DateTimeUtils.getSysDateTime(Boolean.FALSE);
    String nowTimeGMT = DateTimeUtils.getSysDateTime(Boolean.TRUE);
    System.out.println("nowTime " + nowTime);
    System.out.println("nowTimeGMT " + nowTimeGMT);
    Assert.assertNotEquals("nowTime: " + nowTime + ", nowTimeGMT: " + nowTimeGMT, nowTime, nowTimeGMT);
    //        org.springframework.orm.hibernate4.LocalSessionFactoryBean test = new org.springframework.orm.hibernate4.LocalSessionFactoryBean();
    //        test.setHibernateProperties(hibernateProperties);
    //        java.util.Properties 
}

From source file:Main.java

/**
 * <p>Negates the specified boolean.</p>
 *
 * <p>If {@code null} is passed in, {@code null} will be returned.</p>
 *
 * <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p>
 *
 * <pre>/*w w  w .j  a v  a 2  s  .  c o m*/
 *   BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE;
 *   BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE;
 *   BooleanUtils.negate(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to negate, may be null
 * @return the negated Boolean, or {@code null} if {@code null} input
 */
public static Boolean negate(Boolean bool) {
    if (bool == null) {
        return null;
    }
    return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
}

From source file:com.amazonaws.hal.client.JsonUnmarshallerUtil.java

static Object getObjectForToken(JsonToken token, JsonUnmarshallerContext context) throws IOException {
    switch (token) {
    case VALUE_STRING:
        return context.getJsonParser().getText();
    case VALUE_NUMBER_FLOAT:
    case VALUE_NUMBER_INT:
        return context.getJsonParser().getNumberValue();
    case VALUE_FALSE:
        return Boolean.FALSE;
    case VALUE_TRUE:
        return Boolean.TRUE;
    case VALUE_NULL:
        return null;
    default:/*from   www.  j  ava  2  s. co m*/
        throw new RuntimeException("We expected a VALUE token but got: " + token);
    }
}

From source file:Main.java

/**
 * <p>Negates the specified boolean.</p>
 *
 * <p>If {@code null} is passed in, {@code null} will be returned.</p>
 *
 * <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p>
 *
 * <pre>//w  ww  . j av  a2 s.c o m
 *   BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE;
 *   BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE;
 *   BooleanUtils.negate(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to negate, may be null
 * @return the negated Boolean, or {@code null} if {@code null} input
 */
public static Boolean negate(final Boolean bool) {
    if (bool == null) {
        return null;
    }
    return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
}

From source file:Main.java

/**
 * <p>Boolean factory that avoids creating new Boolean objecs all the time.</p>
 * //from   w  w w.  j  a  v a 2 s .com
 * <p>This method was added to JDK1.4 but is available here for earlier JDKs.</p>
 *
 * <pre>
 *   BooleanUtils.toBooleanObject(false) = Boolean.FALSE
 *   BooleanUtils.toBooleanObject(true)  = Boolean.TRUE
 * </pre>
 *
 * @param bool  the boolean to convert
 * @return Boolean.TRUE or Boolean.FALSE as appropriate
 */
public static Boolean toBooleanObject(boolean bool) {
    return bool ? Boolean.TRUE : Boolean.FALSE;
}

From source file:Main.java

/**
 * <p>Converts an int to a Boolean using the convention that {@code zero}
 * is {@code false}.</p>/* ww  w  .j a va 2  s  .c o m*/
 *
 * <pre>
 *   BooleanUtils.toBoolean(0) = Boolean.FALSE
 *   BooleanUtils.toBoolean(1) = Boolean.TRUE
 *   BooleanUtils.toBoolean(2) = Boolean.TRUE
 * </pre>
 *
 * @param value  the int to convert
 * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero,
 *  {@code null} if {@code null}
 */
public static Boolean toBooleanObject(int value) {
    return value == 0 ? Boolean.FALSE : Boolean.TRUE;
}

From source file:io.opentracing.contrib.elasticsearch.common.SpanDecorator.java

public static void onError(Throwable throwable, Span span) {
    Tags.ERROR.set(span, Boolean.TRUE);
    span.log(errorLogs(throwable));
}

From source file:eu.arthepsy.sonar.plugins.scapegoat.util.XmlUtils.java

public static SMInputFactory createFactory() {
    XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
    SMInputFactory inputFactory = new SMInputFactory(xmlFactory);
    return inputFactory;
}