Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

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

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:com.csc.fi.ioapi.utils.JerseyJsonLDClient.java

public static Boolean readBooleanFromURL(String url) {
    try {//from www.  j av a2s  . c  om

        Client client = ClientBuilder.newClient();
        WebTarget target = client.target(url);
        Response response = target.request("application/json").get();

        if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
            logger.info("Failed to read boolean from: " + url + " " + response.getStatus());
            return Boolean.FALSE;
        }

        DataInputStream dis = new DataInputStream(response.readEntity(InputStream.class));
        return new Boolean(dis.readBoolean());

    } catch (Exception ex) {
        logger.info("Failed in reading boolean from URL ... returning false");
        return Boolean.FALSE;
    }
}

From source file:GenderEditor.java

public Object getCellEditorValue() {
    return new Boolean(getSelectedIndex() == 0 ? true : false);
}

From source file:info.magnolia.cms.util.NodeDataUtil.java

/**
 * Returns the value as an Object.// ww  w .  j  a va  2s.  co m
 * @return Object
 */
public static Object getValue(NodeData nd) {
    try {
        switch (nd.getType()) {
        case (PropertyType.STRING):
            return nd.getString();
        case (PropertyType.DOUBLE):
            return new Double(nd.getDouble());
        case (PropertyType.LONG):
            return new Long(nd.getLong());
        case (PropertyType.BOOLEAN):
            return new Boolean(nd.getBoolean());
        case (PropertyType.DATE):
            return nd.getDate().getTime();
        case (PropertyType.BINARY):
            return null;
        default:
            return null;
        }
    } catch (Exception e) {
        if (log.isDebugEnabled())
            log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$
    }
    return null;
}

From source file:com.cyberway.issue.crawler.filter.PathDepthFilter.java

/**
 * @param name//from  w  w  w. j a v  a 2  s .  co m
 */
public PathDepthFilter(String name) {
    super(name, "Path depth less or equal filter  *Deprecated* Use"
            + "DecidingFilter and equivalent DecideRule instead.");
    addElementToDefinition(new SimpleType(ATTR_MAX_PATH_DEPTH,
            "Max path" + " depth for which this filter will match", maxPathDepth));
    addElementToDefinition(new SimpleType(ATTR_MATCH_RETURN_VALUE,
            "What to return when path depth is less or equal to max path" + " depth. \n", new Boolean(true)));
}

From source file:com.baobao121.baby.common.ConnectorServlet.java

/**
 * Initialize the servlet.<br>//from  w ww.  ja va2s .  c om
 * Retrieve from the servlet configuration the "baseDir" which is the root
 * of the file repository:<br>
 * If not specified the value of "/UserFiles/" will be used.
 * 
 */
public void init() throws ServletException {
    baseDir = getInitParameter("baseDir");
    debug = (new Boolean(getInitParameter("debug"))).booleanValue();
    if (baseDir == null)
        baseDir = "/UserFiles/";
    String realBaseDir = getServletContext().getRealPath(baseDir);
    File baseFile = new File(realBaseDir);
    if (!baseFile.exists()) {
        baseFile.mkdir();
    }
}

From source file:org.openmrs.module.imbmetadata.deploy.bundle.CoreMetadataBundle.java

private void installPersonAttributeTypes() {
    log.info("Installing Person Attribute Types");

    install(personAttributeType(PersonAttributeType.TEST_PATIENT.NAME,
            PersonAttributeType.TEST_PATIENT.DESCRIPTION, Boolean.class, null,
            new Boolean(PersonAttributeType.TEST_PATIENT.SEARCHABLE).booleanValue(),
            new Double(PersonAttributeType.TEST_PATIENT.SORT_WEIGHT), PersonAttributeType.TEST_PATIENT.UUID));

    install(personAttributeType(PersonAttributeType.UNKNOWN_PATIENT.NAME,
            PersonAttributeType.UNKNOWN_PATIENT.DESCRIPTION, String.class, null,
            new Boolean(PersonAttributeType.UNKNOWN_PATIENT.SEARCHABLE).booleanValue(),
            new Double(PersonAttributeType.UNKNOWN_PATIENT.SORT_WEIGHT),
            PersonAttributeType.UNKNOWN_PATIENT.UUID));
}

From source file:bencoding.securely.Converters.java

public static String BooleanToString(Boolean value) {
    String sValue = new Boolean(value).toString();
    return sValue;
}

From source file:Main.java

public Main() {
    super(new GridLayout(1, 0));

    final String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };

    final Object[][] data = { { "Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false) },
            { "Alison", "Huml", "Rowing", new Integer(3), new Boolean(true) },
            { "Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false) },
            { "Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true) },
            { "Philip", "Milne", "Pool", new Integer(10), new Boolean(false) } };

    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);/*from  w  w  w  .j av a  2s.  c o  m*/

    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    if (ALLOW_ROW_SELECTION) { // true by default
        ListSelectionModel rowSM = table.getSelectionModel();
        rowSM.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                // Ignore extra messages.
                if (e.getValueIsAdjusting())
                    return;

                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                if (lsm.isSelectionEmpty()) {
                    System.out.println("No rows are selected.");
                } else {
                    int selectedRow = lsm.getMinSelectionIndex();
                    System.out.println("Row " + selectedRow + " is now selected.");
                }
            }
        });
    } else {
        table.setRowSelectionAllowed(false);
    }

    if (ALLOW_COLUMN_SELECTION) { // false by default
        if (ALLOW_ROW_SELECTION) {
            // We allow both row and column selection, which
            // implies that we *really* want to allow individual
            // cell selection.
            table.setCellSelectionEnabled(true);
        }
        table.setColumnSelectionAllowed(true);
        ListSelectionModel colSM = table.getColumnModel().getSelectionModel();
        colSM.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                // Ignore extra messages.
                if (e.getValueIsAdjusting())
                    return;

                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                if (lsm.isSelectionEmpty()) {
                    System.out.println("No columns are selected.");
                } else {
                    int selectedCol = lsm.getMinSelectionIndex();
                    System.out.println("Column " + selectedCol + " is now selected.");
                }
            }
        });
    }

    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
}

From source file:com.textuality.lifesaver2.Columns.java

public static Map<String, Boolean> loadKeys(Context context, Uri provider, Columns columns) {
    Cursor cursor = context.getContentResolver().query(provider, null, null, null, null);
    Boolean exists = new Boolean(true);
    Map<String, Boolean> map = new Hashtable<String, Boolean>();
    while (cursor.moveToNext()) {
        map.put(columns.cursorToKey(cursor), exists);
    }//w  ww.j a  v a 2  s  .  com
    cursor.close();
    return map;
}

From source file:SimpleTableSelectionDemo.java

public SimpleTableSelectionDemo() {
    super(new GridLayout(1, 0));

    final String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };

    final Object[][] data = { { "Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false) },
            { "Alison", "Huml", "Rowing", new Integer(3), new Boolean(true) },
            { "Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false) },
            { "Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true) },
            { "Philip", "Milne", "Pool", new Integer(10), new Boolean(false) } };

    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);/*from w w w.j  a v a 2  s.c om*/

    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    if (ALLOW_ROW_SELECTION) { // true by default
        ListSelectionModel rowSM = table.getSelectionModel();
        rowSM.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                // Ignore extra messages.
                if (e.getValueIsAdjusting())
                    return;

                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                if (lsm.isSelectionEmpty()) {
                    System.out.println("No rows are selected.");
                } else {
                    int selectedRow = lsm.getMinSelectionIndex();
                    System.out.println("Row " + selectedRow + " is now selected.");
                }
            }
        });
    } else {
        table.setRowSelectionAllowed(false);
    }

    if (ALLOW_COLUMN_SELECTION) { // false by default
        if (ALLOW_ROW_SELECTION) {
            // We allow both row and column selection, which
            // implies that we *really* want to allow individual
            // cell selection.
            table.setCellSelectionEnabled(true);
        }
        table.setColumnSelectionAllowed(true);
        ListSelectionModel colSM = table.getColumnModel().getSelectionModel();
        colSM.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                // Ignore extra messages.
                if (e.getValueIsAdjusting())
                    return;

                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                if (lsm.isSelectionEmpty()) {
                    System.out.println("No columns are selected.");
                } else {
                    int selectedCol = lsm.getMinSelectionIndex();
                    System.out.println("Column " + selectedCol + " is now selected.");
                }
            }
        });
    }

    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);
}