net.sourceforge.stripes.validation
Class FloatTypeConverter

java.lang.Object
  extended by net.sourceforge.stripes.validation.NumberTypeConverterSupport
      extended by net.sourceforge.stripes.validation.FloatTypeConverter
All Implemented Interfaces:
TypeConverter<Float>

public class FloatTypeConverter
extends NumberTypeConverterSupport
implements TypeConverter<Float>

Basic TypeConverter that converts Strings to Numbers of type Float. If the String is a valid number, but the number is out of the range representable by the Float class, a validation error of 'converter.float.outOfRange' will be produced.

Author:
Tim Fennell

Field Summary
static float MAX_VALUE
          The maximum value that can assigned to a float or Float.
static float MIN_VALUE
          The minimum value that can assigned to a float or Float.
 
Constructor Summary
FloatTypeConverter()
           
 
Method Summary
 Float convert(String input, Class<? extends Float> targetType, Collection<ValidationError> errors)
          Converts the input to an object of type Double.
 
Methods inherited from class net.sourceforge.stripes.validation.NumberTypeConverterSupport
getLocale, getNumberFormats, parse, preprocess, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.stripes.validation.TypeConverter
setLocale
 

Field Detail

MIN_VALUE

public static final float MIN_VALUE
The minimum value that can assigned to a float or Float.

See Also:
Constant Field Values

MAX_VALUE

public static final float MAX_VALUE
The maximum value that can assigned to a float or Float.

See Also:
Constant Field Values
Constructor Detail

FloatTypeConverter

public FloatTypeConverter()
Method Detail

convert

public Float convert(String input,
                     Class<? extends Float> targetType,
                     Collection<ValidationError> errors)
Converts the input to an object of type Double.

Specified by:
convert in interface TypeConverter<Float>
Parameters:
input - the String being converted
targetType - the Class representing the type of the property to which the return value of the conversion will be assigned. In many cases this can be ignored as converters will return a single type more often than not.
errors - an empty collection of validation errors that should be populated by the converter for any errors that occur during validation that are user input related.
Returns:
T an instance of the converted type, or null if the input cannot be converted


? Copyright 2005-2006, Stripes Development Team.