net.sourceforge.stripes.validation
Class ByteTypeConverter
java.lang.Object
net.sourceforge.stripes.validation.NumberTypeConverterSupport
net.sourceforge.stripes.validation.ByteTypeConverter
- All Implemented Interfaces:
- TypeConverter<Byte>
public class ByteTypeConverter
- extends NumberTypeConverterSupport
- implements TypeConverter<Byte>
Basic type converter for converting strings to bytes. Will produce one error if the String
supplied is not a parsable number, and another error if the number is parseable but outside of
the range Byte.MIN_VALUE =< X =< Byte.MAX_VALUE.
- Author:
- Tim Fennell
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteTypeConverter
public ByteTypeConverter()
convert
public Byte convert(String input,
Class<? extends Byte> targetType,
Collection<ValidationError> errors)
- Converts a String to a Byte in accordance with the rules laid out in the class level javadoc.
- Specified by:
convert
in interface TypeConverter<Byte>
- Parameters:
input
- the String being convertedtargetType
- 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
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.