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:Main.java

/**
 * <p>Checks if a {@code Boolean} value is {@code true},
 * handling {@code null} by returning {@code false}.</p>
 *
 * <pre>/*from  w  w w  .j  a  v  a2 s  . c om*/
 *   BooleanUtils.isTrue(Boolean.TRUE)  = true
 *   BooleanUtils.isTrue(Boolean.FALSE) = false
 *   BooleanUtils.isTrue(null)          = false
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code false}
 * @return {@code true} only if the input is non-null and true
 * @since 2.1
 */
public static boolean isTrue(Boolean bool) {
    return Boolean.TRUE.equals(bool);
}

From source file:Main.java

public static Document createDocument(boolean standalone) throws ParserConfigurationException {
    DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
    f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
    DocumentBuilder b = f.newDocumentBuilder();
    Document d = b.newDocument();
    d.setXmlStandalone(standalone);/*from   w ww  . ja  v a2  s . c  o m*/
    return d;
}

From source file:Main.java

public static int getBooleanInt(SharedPreferences prefs, String key) {
    return getBooleanInt(prefs, key, Boolean.TRUE);
}

From source file:Main.java

/**
 * Sets vsyncRequested state for the {@code rootContainer}.  If
 * {@code isRequested} is {@code true} then vsynced
 * {@code BufferStrategy} is enabled for this {@code rootContainer}.
 *
 * Note: requesting vsynced painting does not guarantee one. The outcome
 * depends on current RepaintManager's RepaintManager.PaintManager
 * and on the capabilities of the graphics hardware/software and what not.
 *
 * @param rootContainer topmost container. Should be either {@code Window}
 *  or {@code Applet}// w  w  w .j ava2  s .  c  om
 * @param isRequested the value to set vsyncRequested state to
 */
public static void setVsyncRequested(Container rootContainer, boolean isRequested) {
    assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
    if (isRequested) {
        vsyncedMap.put(rootContainer, Boolean.TRUE);
    } else {
        vsyncedMap.remove(rootContainer);
    }
}

From source file:Main.java

/**
 * Parse XML using JAXB and a model class.
 * /*  w  ww  . ja  va2  s.  c  o  m*/
 * @param in an input stream
 * @return the requested object
 * @param cls the root class
 * @throws JAXBException thrown on an error
 */
@SuppressWarnings("unchecked")
public static <T> T parseJaxb(Class<T> cls, InputStream in) throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(cls);
    Marshaller m = context.createMarshaller();
    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    Unmarshaller um = context.createUnmarshaller();
    return (T) um.unmarshal(in);
}

From source file:Main.java

public static Boolean isFamilyBirthday(TemporalAccessor date) {
    int month = date.get(ChronoField.MONTH_OF_YEAR);
    int day = date.get(ChronoField.DAY_OF_MONTH);

    // Angie's birthday is on April 3.
    if ((month == Month.APRIL.getValue()) && (day == 3))
        return Boolean.TRUE;

    // Sue's birthday is on June 18.
    if ((month == Month.JUNE.getValue()) && (day == 18))
        return Boolean.TRUE;

    // Joe's birthday is on May 29.
    if ((month == Month.MAY.getValue()) && (day == 29))
        return Boolean.TRUE;

    return Boolean.FALSE;
}

From source file:Main.java

/**
 * <p>Negates the specified boolean.</p>
 * /*  ww  w.  j  a va 2 s  . c om*/
 * <p>If <code>null</code> is passed in, <code>null</code> will be returned.</p>
 *
 * <pre>
 *   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</code> if <code>null</code> input
 */
public static Boolean negate(Boolean bool) {
    if (bool == null) {
        return null;
    }
    return (bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE);
}

From source file:io.github.jeddict.jpa.spec.validator.column.JoinColumnValidator.java

public static boolean isEmpty(JoinColumn column) {
    boolean empty = false;
    if (StringUtils.isBlank(column.getName()) && StringUtils.isBlank(column.getReferencedColumnName())
            && StringUtils.isBlank(column.getColumnDefinition()) && StringUtils.isBlank(column.getTable())
            && Boolean.TRUE.equals(column.getNullable()) && Boolean.TRUE.equals(column.getInsertable())
            && Boolean.TRUE.equals(column.getUpdatable()) && Boolean.FALSE.equals(column.getUnique())
            && ForeignKeyValidator.isEmpty(column.getForeignKey())) {
        empty = true;//from  w w w .j  ava2s.co  m
    }
    if (!empty && StringUtils.isBlank(column.getName()) && StringUtils.isNotBlank(column.getImplicitName())) {
        column.setName(column.getImplicitName());
        column.setImplicitName(null);
    }
    if (!empty && StringUtils.isBlank(column.getName())) {
        empty = true;
    }
    return empty;
}

From source file:com.cloudera.oryx.common.random.RandomManager.java

/**
 * @return a new, seeded {@link RandomGenerator}
 *///from  w  w  w . ja  va 2 s  . c o m
public static RandomGenerator getRandom() {
    if (useTestSeed) {
        // No need to track instances anymore
        return new Well19937c(TEST_SEED);
    }
    RandomGenerator random = new Well19937c();
    synchronized (INSTANCES) {
        INSTANCES.put(random, Boolean.TRUE); // Value does not matter
    }
    return random;
}

From source file:Main.java

/**
 * Writes the given document to a stream (pretty-printed)
 * /*from  w  w w  .  j  a  v  a  2  s  .  com*/
 * @param doc Document to serialize
 * @param out the Stream to write to
 * @param encoding The encoding to use
 */
public static void writeDocument(Document doc, OutputStream out, String encoding) {
    if (doc == null)
        return;
    LSSerializer writer = impl.createLSSerializer();
    writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
    LSOutput lsOutput = impl.createLSOutput();
    lsOutput.setByteStream(out);
    lsOutput.setEncoding(encoding);
    writer.write(doc, lsOutput);
}