Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbehave.core.steps
Class ParameterConverters.NumberConverter

    java.lang.Object
      org.jbehave.core.steps.ParameterConverters.NumberConverter

All Implemented Interfaces:
  ParameterConverters.ParameterConverter

Enclosing class:
  ParameterConverters

    public static class ParameterConverters.NumberConverter

extends Object
implements ParameterConverters.ParameterConverter

Converts values to numbers, supporting any subclass of `Number` (including generic Number type), and it unboxed counterpart, using a `NumberFormat` to parse to a `Number` and to convert it to a specific number type:

- Byte, byte: `Number.byteValue()`
- Short, short: `Number.shortValue()`
- Integer, int: `Number.intValue()`
- Float, float: `Number.floatValue()`
- Long, long: `Number.longValue()`
- Double, double: `Number.doubleValue()`
- BigInteger: `BigInteger#valueOf(Long)`
- BigDecimal: `BigDecimal#valueOf(Double)`

If no number format is provided, it defaults to `NumberFormat#getInstance(Locale.ENGLISH)`.

The localized instance `NumberFormat.getInstance(Locale)` can be used to convert numbers in specific locales.

Constructor Summary
`ParameterConverters.NumberConverter()`
`ParameterConverters.NumberConverter(NumberFormat numberFormat)`

Method Summary
`boolean` | `accept(Type type)`
`Object` | `convertValue(String value, Type type)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ParameterConverters.NumberConverter

    public ParameterConverters.NumberConverter()

### ParameterConverters.NumberConverter

    public ParameterConverters.NumberConverter(NumberFormat numberFormat)

Method Detail

### accept

    public boolean accept(Type type)

  Specified by:
    `accept` in interface `ParameterConverters.ParameterConverter`

### convertValue

    public Object convertValue(String value,
                               Type type)

  Specified by:
    `convertValue` in interface `ParameterConverters.ParameterConverter`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2013. All Rights Reserved.