Java Code Examples for javax.xml.bind.DatatypeConverter#parseBoolean()

The following examples show how to use javax.xml.bind.DatatypeConverter#parseBoolean() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: OpenEstate-IO   File: WisItUtils.java    License: Apache License 2.0 5 votes vote down vote up
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
        throw new IllegalArgumentException("Can't parse boolean value!");
}
 
Example 2
public static Boolean parseXsdBooleanToBoolean(String value) throws DataConversionException {
    Boolean result = null;
    try {
        result = DatatypeConverter.parseBoolean(value);    
    } catch(Exception e) {
        logger.fatal("Unable to parse xsd:boolean to "+Boolean.class.getName()+".",e);
        throw new DataConversionException("Unable to parse xsd:boolean to "+Boolean.class.getName()+".", e);
    }
    
    return result;
}
 
Example 3
Source Project: java-client-api   File: ValueConverter.java    License: Apache License 2.0 5 votes vote down vote up
static public boolean StringToBooleanPrimitive(String value) {
  try {
    return DatatypeConverter.parseBoolean(value);
  } catch(Exception e) {
    throw new IllegalArgumentException("Could not convert to boolean: "+value, e);
  }
}
 
Example 4
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 5
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 6
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 7
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 8
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 9
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 10
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 11
public Boolean unmarshal(String v) {
    if(v==null)     return null;
    return DatatypeConverter.parseBoolean(v);
}
 
Example 12
Source Project: OpenEstate-IO   File: KyeroUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static Boolean parseBoolType(String value) {
    value = StringUtils.trimToNull(value);
    return (value != null) ? DatatypeConverter.parseBoolean(value) : null;
}
 
Example 13
Source Project: java-client-api   File: XsValueImpl.java    License: Apache License 2.0 4 votes vote down vote up
public BooleanValImpl(String value) {
    this(DatatypeConverter.parseBoolean(value));
}