Package net.sf.jguiraffe.transform
Class FloatTransformer
- java.lang.Object
-
- net.sf.jguiraffe.transform.NumberTransformerBase<T>
-
- net.sf.jguiraffe.transform.AbstractDecimalTransformer<Float>
-
- net.sf.jguiraffe.transform.FloatTransformer
-
- All Implemented Interfaces:
Transformer
,Validator
public class FloatTransformer extends AbstractDecimalTransformer<Float>
A specialized number transformer implementation that deals with numbers of type
java.lang.Float
.This class implements the abstract methods defined by its super classes in a way suitable for
java.lang.Float
objects. It does not define any new properties or error messages. Refer to the documentation of
for a list of all supported properties and possible error messages.NumberTransformerBase
- Version:
- $Id: FloatTransformer.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Field Summary
-
Fields inherited from class net.sf.jguiraffe.transform.NumberTransformerBase
PROP_MAXIMUM, PROP_MINIMUM
-
-
Constructor Summary
Constructors Constructor Description FloatTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Float
convert(Number n)
Converts the specified number into aFloat
.protected Float
fetchProperty(org.apache.commons.configuration.Configuration config, String property, Float defaultValue)
Fetches a float property from the specified configuration.-
Methods inherited from class net.sf.jguiraffe.transform.AbstractDecimalTransformer
createFormat
-
Methods inherited from class net.sf.jguiraffe.transform.NumberTransformerBase
errorResult, getMaximum, getMinimum, isNumberValid, isValid, setMaximum, setMinimum, transform, transformToNumber
-
-
-
-
Method Detail
-
convert
protected Float convert(Number n)
Converts the specified number into aFloat
. If the number exceeds the value range of a float, an exception is thrown.- Specified by:
convert
in classNumberTransformerBase<Float>
- Parameters:
n
- the number to convert- Returns:
- the converted number
- Throws:
IllegalArgumentException
- if the number cannot be converted
-
fetchProperty
protected Float fetchProperty(org.apache.commons.configuration.Configuration config, String property, Float defaultValue)
Fetches a float property from the specified configuration.- Specified by:
fetchProperty
in classNumberTransformerBase<Float>
- Parameters:
config
- the configurationproperty
- the propertydefaultValue
- the default value- Returns:
- the value of this property
-
-