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:com.technofovea.hl2parse.vdf.MaterialReader.java

public static final MaterialRefList loadFromXml(InputStream stream) throws JAXBException {
    JAXBContext jc = JAXBContext.newInstance(MaterialReference.class, MaterialRefList.class);
    Unmarshaller um = jc.createUnmarshaller();
    Marshaller m = jc.createMarshaller();
    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    Object o = um.unmarshal(stream);
    return (MaterialRefList) o;
}

From source file:Main.java

/**
 * Parses the attribute's value. If the value is 0 or "false" then false is returned, if the value is 1 or "true"
 * then true is returned, if the value is anything else then null returned.
 * // w  w w .  j  a  v a2 s .co  m
 * @param attribute attribute whose value will be converted to a boolean
 * 
 * @return boolean value of the attribute or null
 */
public static Boolean getAttributeValueAsBoolean(Attr attribute) {
    if (attribute == null) {
        return null;
    }

    String valueStr = attribute.getValue();
    if (valueStr.equals("0") || valueStr.equals("false")) {
        return Boolean.FALSE;
    } else if (valueStr.equals("1") || valueStr.equals("true")) {
        return Boolean.TRUE;
    } else {
        return null;
    }
}

From source file:com.sylvanaar.idea.Lua.editor.inspections.utils.BoolUtils.java

public static boolean isTrue(LuaConditionalExpression condition) {
    Object value = ObjectUtils.defaultIfNull(condition.evaluate(), UNKNOWN);
    return value.equals(Boolean.TRUE);
}

From source file:edu.usu.sdl.openstorefront.common.util.Convert.java

/**
 * Converts an object to a boolean It's meant for handling different string
 * representation//from  w w w .  ja  v  a 2s.  c o m
 *
 * @param data
 * @return
 */
public static boolean toBoolean(Object data) {
    if (data != null) {
        if (data instanceof Boolean) {
            return (Boolean) data;
        } else if (data instanceof String) {
            if ("T".equalsIgnoreCase(data.toString().trim())) {
                return Boolean.TRUE;
            } else if ("1".equalsIgnoreCase(data.toString().trim())) {
                return Boolean.TRUE;
            } else {
                return Boolean.parseBoolean(data.toString().trim());
            }
        } else {
            return Boolean.TRUE;
        }

    }
    return Boolean.FALSE;
}

From source file:Main.java

public static Document readXml(InputStream input)
        throws ParserConfigurationException, IOException, SAXException {
    DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
    f.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
    DocumentBuilder b = f.newDocumentBuilder();
    return b.parse(input);
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.Html2Text.java

public void parse(Reader in) throws IOException {
    s = new StringBuffer();
    ParserDelegator delegator = new ParserDelegator();
    // the third parameter is TRUE to ignore charset directive
    delegator.parse(in, this, Boolean.TRUE);
}

From source file:Main.java

@SuppressWarnings("rawtypes")
public static void marshal(Object object, Writer w) throws JAXBException {
    Class clazz = object.getClass();
    JAXBContext context = s_contexts.get(clazz);
    if (context == null) {
        context = JAXBContext.newInstance(clazz);
        s_contexts.put(clazz, context);//from   w  ww.  j a  va2  s. c o m
    }

    ValidationEventCollector valEventHndlr = new ValidationEventCollector();
    Marshaller marshaller = context.createMarshaller();
    marshaller.setSchema(null);
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    marshaller.setEventHandler(valEventHndlr);

    try {
        marshaller.marshal(object, w);
    } catch (Exception e) {
        if (e instanceof JAXBException) {
            throw (JAXBException) e;
        } else {
            throw new MarshalException(e.getMessage(), e);
        }
    }
    if (valEventHndlr.hasEvents()) {
        for (ValidationEvent valEvent : valEventHndlr.getEvents()) {
            if (valEvent.getSeverity() != ValidationEvent.WARNING) {
                // throw a new Marshall Exception if there is a parsing error
                throw new MarshalException(valEvent.getMessage(), valEvent.getLinkedException());
            }
        }
    }
}

From source file:Main.java

public static void saveInstance(OutputStream outputStream, URL schemaURL, String schemaName, Object instance)
        throws JAXBException,

        IOException {//from  ww w  . j  a va 2 s  .c  o m

    Marshaller marshaller = JAXBContext.newInstance(instance.getClass()).createMarshaller();

    marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaURL + " " + schemaName);

    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    marshaller.marshal(instance, outputStream);

    outputStream.flush();

}

From source file:com.google.cloud.genomics.dockerflow.util.StringUtils.java

/**
 * Parse command-line options of the form --key=value into a map of <key,value>.
 * For --key without a value, set the value to true.
 *
 * @param args//w  ww  . j a va  2  s . com
 * @return
 */
public static Map<String, String> parseArgs(String[] args) {
    Map<String, String> m = new HashMap<String, String>();
    if (args != null) {
        for (String s : args) {
            if (s.indexOf("=") < 0) {
                m.put(s.replace("--", ""), Boolean.TRUE.toString());
            } else {
                String key = s.substring(0, s.indexOf("=")).replace("--", "");
                String val = s.substring(s.indexOf("=") + 1);
                if (m.containsKey(key)) {
                    val = m.get(key) + "," + val;
                }
                m.put(key, val);
            }
        }
    }
    return m;
}

From source file:com.haulmont.cuba.gui.app.security.role.edit.PermissionUiHelper.java

public static PermissionVariant getCheckBoxVariant(Object value, PermissionVariant activeVariant) {
    PermissionVariant permissionVariant;
    if (Boolean.TRUE.equals(value))
        permissionVariant = activeVariant;
    else/*from w w  w .  java2  s .  c  om*/
        permissionVariant = PermissionVariant.NOTSET;
    return permissionVariant;
}