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

The following examples show how to use javax.xml.bind.DatatypeConverter#printDouble() . 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
public static String printDoubleToXsdDouble(Double value) throws DataConversionException {
    String result = null;
    
    try {
        result = DatatypeConverter.printDouble(value);
    } catch(Exception e) {
        logger.fatal("Unable to print "+Double.class.getName()+" to xsd:double.",e);
        throw new DataConversionException("Unable to print "+Double.class.getName()+" to xsd:double.", e);
    }
    
    return result;
}
 
Example 2
static
public String printNumber(Number value){

	if(value instanceof Float){
		return DatatypeConverter.printFloat(value.floatValue());
	} else

	if(value instanceof Double){
		return DatatypeConverter.printDouble(value.doubleValue());
	} else

	{
		return value.toString();
	}
}
 
Example 3
Source Project: java-client-api   File: ValueConverter.java    License: Apache License 2.0 4 votes vote down vote up
static public String DoublePrimitiveToString(double value) {
  return DatatypeConverter.printDouble(value);
}
 
Example 4
Source Project: java-client-api   File: XsValueImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return DatatypeConverter.printDouble(value);
}