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

public boolean myMethod(int p1, Object p2) {
    Logger logger = Logger.getLogger("com.mycompany.MyClass");
    if (logger.isLoggable(Level.FINER)) {
        logger.entering(this.getClass().getName(), "myMethod", new Object[] { new Integer(p1), p2 });
    }/* ww  w . j a va 2  s.c o m*/

    System.out.println("Method body");

    boolean result = true;
    if (logger.isLoggable(Level.FINER)) {
        logger.exiting(this.getClass().getName(), "myMethod", new Boolean(result));
        logger.exiting(this.getClass().getName(), "myMethod");
    }
    return result;
}

From source file:MainClass.java

public MainClass() throws Exception {
    getContentPane().setLayout(new BorderLayout());

    Object[][] data = { { "A", "B", "C", new Integer(5), new Boolean(false) },
            { "D", "E", "F", new Integer(3), new Boolean(true) } };

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

    table = new JTable(data, columnNames);

    JPanel tPanel = new JPanel(new BorderLayout());
    tPanel.add(table.getTableHeader(), BorderLayout.NORTH);
    tPanel.add(table, BorderLayout.CENTER);

    getContentPane().add(tPanel, BorderLayout.CENTER);

    Document document = new Document();
    PdfWriter writer;// ww w  .  ja  va2  s .com

    writer = PdfWriter.getInstance(document, new FileOutputStream("my_jtable_shapes.pdf"));

    // writer = PdfWriter.getInstance(document, new
    // FileOutputStream("my_jtable_fonts.pdf"));

    document.open();
    PdfContentByte cb = writer.getDirectContent();

    PdfTemplate tp = cb.createTemplate(500, 500);
    Graphics2D g2;

    g2 = tp.createGraphicsShapes(500, 500);

    // g2 = tp.createGraphics(500, 500);
    table.print(g2);
    g2.dispose();
    cb.addTemplate(tp, 30, 300);

    // step 5: we close the document
    document.close();
}

From source file:cz.incad.kramerius.rest.api.k5.client.utils.SOLRUtils.java

public static <T> T value(String val, Class<T> clz) {
    if (val == null)
        return null;
    val = val.trim();
    if (clz.equals(String.class))
        return (T) val;
    else if (clz.equals(Boolean.class))
        return (T) new Boolean(val);
    else if (clz.equals(Integer.class))
        return (T) Integer.valueOf(val);
    else//  ww w .  jav a  2s  .  co m
        throw new IllegalArgumentException("unsupported type " + clz + "");
}

From source file:gov.nih.nci.cabig.caaers.dao.query.StudySitesQuery.java

public StudySitesQuery() {
    super("SELECT distinct ss FROM StudySite ss");
    andWhere("ss.retiredIndicator = :" + RETIRED_INDICATOR);
    setParameter(RETIRED_INDICATOR, new Boolean(false));
    joinStudies();//from w  ww.  java2s  . c o m
    leftJoin("study.identifiers as identifier");
}

From source file:net.sf.packtag.util.SafeLogger.java

/** Returns true if the classes from the Apache Commons Logging library is available */
protected static boolean isCommonsLoggingAvailable() {
    if (commonsLoggingAvailable == null) {
        synchronized (SafeLogger.class) {
            if (commonsLoggingAvailable == null) {
                try {
                    commonsLoggingAvailable = new Boolean(Class.forName("org.apache.commons.logging") != null);
                } catch (ClassNotFoundException e) {
                    commonsLoggingAvailable = Boolean.FALSE;
                }/*from w  w w .  ja  v  a 2  s . c om*/
            }
        }
    }
    return commonsLoggingAvailable.booleanValue();
}

From source file:blackboard.sonar.plugins.css.node.TextNode.java

public TextNode() {
    super(NodeType.Text);
    this.invalidSelector = new Boolean(false);
}

From source file:MainClass.java

public Object[][] getFileStats(File dir) {
    String files[] = dir.list();/* w  ww  .j a v  a2 s .c om*/
    Object[][] results = new Object[files.length][titles.length];

    for (int i = 0; i < files.length; i++) {
        File tmp = new File(files[i]);
        results[i][0] = new Boolean(tmp.isDirectory());
        results[i][1] = tmp.getName();
        results[i][2] = new Boolean(tmp.canRead());
        results[i][3] = new Boolean(tmp.canWrite());
        results[i][4] = new Long(tmp.length());
        results[i][5] = new Date(tmp.lastModified());
    }
    return results;
}

From source file:Main.java

public static Object getNamedElemValue(Element parent, String elementName, Class basicType, Object defaultVal) {
    String val = getNamedElemValue(parent, elementName);
    if (val == null) {
        return defaultVal;
    }//ww  w. jav  a2  s  .c  o  m

    try {
        if (Boolean.class.equals(basicType)) {
            return new Boolean(val);
        } else if (Integer.class.equals(basicType)) {
            return new Integer(val);
        } else if (Float.class.equals(basicType)) {
            return new Float(val);
        } else if (Double.class.equals(basicType)) {
            return new Double(val);
        } else
            return val;
    } catch (Exception e) {
        return defaultVal;
    }
}

From source file:com.cyclopsgroup.waterview.web.taglib.FormTag.java

static void setHideControls(boolean hideControls, JellyContext context) {
    context.setVariable(HIDE_CONTROLS, new Boolean(hideControls));
}

From source file:org.openmrs.module.pmtct.BooleanEditor.java

public void setAsText(String text) throws IllegalArgumentException {
    if (StringUtils.hasText(text)) {
        try {/*from   ww w. ja  v a 2 s . c om*/
            if (text.equals("1"))
                setValue(new Boolean(true));
            else if (text.equals("0"))
                setValue(new Boolean(false));
        } catch (Exception ex) {
            log.error("Error setting text: " + text, ex);
            throw new IllegalArgumentException("User not found: " + ex.getMessage());
        }
    } else {
        setValue(null);
    }
}