Top Description Fields Constructors Methods
org.jruby.util

public final Class SafeDoubleParser

extends SafeDecimalParser
Class Inheritance
Imports
java.math.BigDecimal

A safer way to parse double values

Prevents brute force attacks using the famous Java bug.

Field Summary

Inherited from org.jruby.util.SafeDecimalParser:
LOWERMIDDLETWOUPPER

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static double

Returns:

the double value
doubleValue
(Number number)

Safe way of getting the double value prevents BigDecimal from calling Double.parseDouble()

public static double

Returns:

the double value
doubleValue
(BigDecimal bigDecimal)

Safe way of getting the double value Prevents BigDecimal from calling Double.parseDouble()

public static Double

Returns:

the Double value
parseDouble
(String
The input String
s
)

Safe way of parsing a Double value from a String

public static Double

Returns:

the Double value
valueOf
(String
The input String
s
)

Safe way of parsing a Double value from a String

Inherited from org.jruby.util.SafeDecimalParser:
decimalValuedecimalValuedecimalValueOfisSuspicious

Constructor Detail

SafeDoubleParserback to summary
public SafeDoubleParser()

Method Detail

doubleValueback to summary
public static double doubleValue(Number number)

Safe way of getting the double value
prevents BigDecimal from calling Double.parseDouble()

Returns:double

the double value

doubleValueback to summary
public static double doubleValue(BigDecimal bigDecimal)

Safe way of getting the double value
Prevents BigDecimal from calling Double.parseDouble()

Returns:double

the double value

parseDoubleback to summary
public static Double parseDouble(String s)

Safe way of parsing a Double value from a String

Parameters
s:String

The input String

Returns:Double

the Double value

valueOfback to summary
public static Double valueOf(String s)

Safe way of parsing a Double value from a String

Parameters
s:String

The input String

Returns:Double

the Double value