org.apache.commons.convert.conversion
Class StringToIntegerConversion

java.lang.Object
  extended by org.apache.commons.convert.conversion.AbstractConversion
      extended by org.apache.commons.convert.conversion.StringToIntegerConversion
All Implemented Interfaces:
Conversion

public class StringToIntegerConversion
extends AbstractConversion

Conversion from String to Integer using Integer.valueOf().

Since:
1.0
Version:
$Id: StringToIntegerConversion.java 155441 2005-02-26 13:19:22Z dirkv $
Author:
Stephen Colebourne, Oliver Heger

Field Summary
static Conversion INSTANCE
          Singleton instance of this factory
 
Fields inherited from class org.apache.commons.convert.conversion.AbstractConversion
STRING_CLASS
 
Constructor Summary
protected StringToIntegerConversion()
          Constructor.
 
Method Summary
protected  Object convertValue(Object value, Converter converter)
          Convert the non-null String to an Integer using Integer.valueOf().
 
Methods inherited from class org.apache.commons.convert.conversion.AbstractConversion
convert, getFromType, getToType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final Conversion INSTANCE
Singleton instance of this factory

Constructor Detail

StringToIntegerConversion

protected StringToIntegerConversion()
Constructor.

Method Detail

convertValue

protected Object convertValue(Object value,
                              Converter converter)
Convert the non-null String to an Integer using Integer.valueOf().

Overrides:
convertValue in class AbstractConversion
Parameters:
value - the input value to be converted, pre-checked to not be null
converter - the converter being used, not null
Returns:
the converted value
Throws:
RuntimeException - if conversion fails


Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.