Example usage for javax.xml.bind DatatypeConverter parseBoolean

List of usage examples for javax.xml.bind DatatypeConverter parseBoolean

Introduction

In this page you can find the example usage for javax.xml.bind DatatypeConverter parseBoolean.

Prototype

public static boolean parseBoolean(String lexicalXSDBoolean) 

Source Link

Document

Converts the string argument into a boolean value.

Usage

From source file:org.kalypso.service.wps.refactoring.DefaultWPSProcess.java

private static Object parseValue(final String value, final String dataType) {
    if ("string".equals(dataType)) //$NON-NLS-1$
        return DatatypeConverter.parseString(value);

    if ("int".equals(dataType)) //$NON-NLS-1$
        return DatatypeConverter.parseInt(value);

    if ("double".equals(dataType)) //$NON-NLS-1$
        return DatatypeConverter.parseDouble(value);

    if ("boolean".equals(dataType)) //$NON-NLS-1$
        return DatatypeConverter.parseBoolean(value);

    throw new UnsupportedOperationException("Unknown result type: " + dataType); //$NON-NLS-1$
}

From source file:org.kalypsodeegree_impl.graphics.sld.SLDFactory.java

private static ShadedRelief createShadedRelief(final Element element) {
    if (element == null)
        return null;

    final String brightnessOnlyString = XMLTools.getStringValue("BrightnessOnly", NS.SLD, element, null);
    final Boolean brightnessOnly = brightnessOnlyString == null ? null
            : DatatypeConverter.parseBoolean(brightnessOnlyString);

    final String reliefFactorString = XMLTools.getStringValue("ReliefFactor", NS.SLD, element, null);
    final Double reliefFactor = reliefFactorString == null ? null
            : DatatypeConverter.parseDouble(reliefFactorString);

    return new ShadedRelief(brightnessOnly, reliefFactor);
}

From source file:org.openestate.io.kyero.KyeroUtils.java

public static Boolean parseBoolType(String value) {
    value = StringUtils.trimToNull(value);
    return DatatypeConverter.parseBoolean(value);
}

From source file:org.openestate.io.trovit.TrovitUtils.java

public static Boolean parseBool(String value) {
    value = StringUtils.trimToNull(value);
    if ("si".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value))
        return Boolean.TRUE;
    else if ("no".equalsIgnoreCase(value))
        return Boolean.FALSE;
    else if (value != null)
        return DatatypeConverter.parseBoolean(value);
    else//from   w ww. j  a va 2  s.co  m
        throw new IllegalArgumentException("Can't parse boolean value '" + value + "'!");
}

From source file:org.openestate.io.wis_it.WisItUtils.java

public static Boolean parseYesNo(String value) {
    value = StringUtils.trimToNull(value);
    if ("ja".equalsIgnoreCase(value))
        return Boolean.TRUE;
    else if ("nein".equalsIgnoreCase(value))
        return Boolean.FALSE;
    else if (value != null)
        return DatatypeConverter.parseBoolean(value);
    else/*from w  w w .j  a  va  2  s  .com*/
        throw new IllegalArgumentException("Can't parse boolean value '" + value + "'!");
}