Java Boolean to String boolean2XML(Boolean b)

Here you can find the source of boolean2XML(Boolean b)

Description

Boolean as XML version string.

License

Open Source License

Parameter

Parameter Description
b boolean (true/false)

Return

"yes" or "no"

Declaration


public static String boolean2XML(Boolean b) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from w w  w. ja v  a2 s.  co m*/
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Boolean as XML version string.
     * 
     * @param b
     *            boolean (true/false)
     * @return "yes" or "no"
     */

    public static String boolean2XML(Boolean b) {
        if (b == null || b.equals(Boolean.FALSE)) {
            return "no";
        }
        return "yes";
    }

    /**
     * Boolean as XML version string.
     * 
     * @param b
     *            boolean (true/false)
     * @return "yes" or "no"
     */

    public static String boolean2XML(boolean b) {
        if (!b) {
            return "no";
        }
        return "yes";
    }
}

Related

  1. boolean2XML(Boolean b)
  2. booleanToCheckBox(final boolean value)
  3. booleanToString(boolean a_boolean, String aS_True, String aS_False)
  4. BooleanToString(boolean aB)
  5. booleanToString(Boolean b)