net.sourceforge.stripes.validation
Class IntegerTypeConverter

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

public class IntegerTypeConverter
extends NumberTypeConverterSupport
implements TypeConverter<Integer>

Basic type converter for converting strings to integers.

Author:
Tim Fennell

Constructor Summary
IntegerTypeConverter()
           
 
Method Summary
 Integer convert(String input, Class<? extends Integer> targetType, Collection<ValidationError> errors)
          Convert a String to the target type supported by this converter.
protected  NumberFormat[] getNumberFormats()
          Overridden to return integer instances instead.
 
Methods inherited from class net.sourceforge.stripes.validation.NumberTypeConverterSupport
getLocale, 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
 

Constructor Detail

IntegerTypeConverter

public IntegerTypeConverter()
Method Detail

convert

public Integer convert(String input,
                       Class<? extends Integer> targetType,
                       Collection<ValidationError> errors)
Description copied from interface: TypeConverter
Convert a String to the target type supported by this converter.

Specified by:
convert in interface TypeConverter<Integer>
Parameters:
input -
errors -
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.
Returns:
Integer an Integer object if one can be parsed from the input

getNumberFormats

protected NumberFormat[] getNumberFormats()
Overridden to return integer instances instead.

Overrides:
getNumberFormats in class NumberTypeConverterSupport
Returns:
one or more NumberFormats to use in parsing numbers


? Copyright 2005-2006, Stripes Development Team.