Package org.beanio.types
Class IntegerTypeHandler
- java.lang.Object
-
- org.beanio.types.LocaleSupport
-
- org.beanio.types.NumberTypeHandler
-
- org.beanio.types.IntegerTypeHandler
-
- All Implemented Interfaces:
java.lang.Cloneable
,ConfigurableTypeHandler
,TypeHandler
public class IntegerTypeHandler extends NumberTypeHandler
A type handler implementation for theInteger
class. Ifpattern
is set, aDecimalFormat
is used to parse and format the value. Otherwise, the value is parsed and formatted using theInteger
class.- Since:
- 1.0
- See Also:
DecimalFormat
-
-
Field Summary
-
Fields inherited from class org.beanio.types.LocaleSupport
locale
-
Fields inherited from interface org.beanio.types.ConfigurableTypeHandler
FORMAT_SETTING
-
Fields inherited from interface org.beanio.types.TypeHandler
NIL
-
-
Constructor Summary
Constructors Constructor Description IntegerTypeHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Integer
createNumber(java.lang.String text)
Parses aNumber
from text.protected java.lang.Integer
createNumber(java.math.BigDecimal bg)
Parses aNumber
from aBigDecimal
.java.lang.Class<?>
getType()
Returns the class type supported by this handler.-
Methods inherited from class org.beanio.types.NumberTypeHandler
createDecimalFormat, format, getPattern, newInstance, parse, setPattern
-
Methods inherited from class org.beanio.types.LocaleSupport
getLocale, setLocale
-
-
-
-
Method Detail
-
createNumber
protected java.lang.Integer createNumber(java.lang.String text) throws java.lang.NumberFormatException
Description copied from class:NumberTypeHandler
Parses aNumber
from text.- Specified by:
createNumber
in classNumberTypeHandler
- Parameters:
text
- the text to convert to a Number- Returns:
- the parsed
Number
- Throws:
java.lang.NumberFormatException
- if the text is not a valid number
-
createNumber
protected java.lang.Integer createNumber(java.math.BigDecimal bg) throws java.lang.ArithmeticException
Description copied from class:NumberTypeHandler
Parses aNumber
from aBigDecimal
.- Specified by:
createNumber
in classNumberTypeHandler
- Parameters:
bg
- theBigDecimal
version of the number- Returns:
- the parsed
Number
- Throws:
java.lang.ArithmeticException
- if theBigDecimal
cannot be converted to theNumber
type supported by this handler
-
getType
public java.lang.Class<?> getType()
Description copied from interface:TypeHandler
Returns the class type supported by this handler. Primitive types should not be returned by this method- use the object equivalent instead.- Returns:
- the class type supported by this handler
-
-