org.jbehave.core.steps
Class ParameterConverters.NumberConverter

java.lang.Object
  extended by 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:

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


Copyright © 2003-2012. All Rights Reserved.