org.codehaus.waffle.bind.converters
Class NumberValueConverter
java.lang.Object
org.codehaus.waffle.bind.converters.AbstractValueConverter
org.codehaus.waffle.bind.converters.NumberValueConverter
- All Implemented Interfaces:
- ValueConverter
public class NumberValueConverter
- extends AbstractValueConverter
ValueConverter that converts a value to a Numbers using the NumberFormat instance
provided (which defaults to NumberFormat.getInstance()).
The message keys and default values used are:
- Author:
- Mauro Talevi
| Methods inherited from class org.codehaus.waffle.bind.converters.AbstractValueConverter |
acceptList, acceptMapOfLists, changePatterns, convertMissingValue, getPatterns, matches, messageFor, missingValue, newBindException, patternFor, split |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BIND_ERROR_NUMBER_KEY
public static final String BIND_ERROR_NUMBER_KEY
- See Also:
- Constant Field Values
BIND_ERROR_NUMBER_MISSING_KEY
public static final String BIND_ERROR_NUMBER_MISSING_KEY
- See Also:
- Constant Field Values
DEFAULT_NUMBER_MISSING_MESSAGE
public static final String DEFAULT_NUMBER_MISSING_MESSAGE
- See Also:
- Constant Field Values
DEFAULT_NUMBER_MESSAGE
public static final String DEFAULT_NUMBER_MESSAGE
- See Also:
- Constant Field Values
NumberValueConverter
public NumberValueConverter(MessageResources messageResources)
NumberValueConverter
public NumberValueConverter(MessageResources messageResources,
Properties patterns,
NumberFormat numberFormat)
accept
public boolean accept(Type type)
- Description copied from interface:
ValueConverter
- Determines if converter is compatible with the given type
- Parameters:
type - the Type a value is to be bound to
- Returns:
- A boolean
true is type is compatible
convertValue
public Object convertValue(String propertyName,
String value,
Type toType)
- Description copied from interface:
ValueConverter
- Converts a String value to an Object of a given type
- Parameters:
propertyName - the associated property name, which can be null, also needed to present
customized error messages.value - the String valuetoType - the Object Type
- Returns:
- The converted Object
Copyright © 2008. All Rights Reserved.