org.jbeans.converters
Class CharacterTypeConverter

java.lang.Object
  |
  +--org.jbeans.BaseTypeConverter
        |
        +--org.jbeans.converters.CharacterTypeConverter
All Implemented Interfaces:
TypeConverter

public class CharacterTypeConverter
extends BaseTypeConverter

This class is the main character converter. It is able to convert strings to the java.lnag.Character wrapper class. This is done by simply taking the string and transferring the single character to a Character object. This fails if the String is longer than one character though. Since this class sub-classes BaseTypeConverter it is able to convert to and from arrays. See the parent for more information.

Author:
Brian Pontarelli

Constructor Summary
CharacterTypeConverter()
          Creates new Character TypeConverter
 
Method Summary
 Object convertString(String value, Class convertTo)
          Converts the string to the given type.
 
Methods inherited from class org.jbeans.BaseTypeConverter
convert, convertArray, convertArrayToArray, convertStringToArray, convertToArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterTypeConverter

public CharacterTypeConverter()
Creates new Character TypeConverter
Method Detail

convertString

public Object convertString(String value,
                            Class convertTo)
                     throws TypeConversionException
Converts the string to the given type. This method first calls the parents convertString method to handle the empty and array cases. If the parent method returns value, then this method will convert the string to a character. If the string is longer than one character, an exception is thrown
Overrides:
convertString in class BaseTypeConverter
Parameters:
value - The string value to convert
convertTo - The type to convert the string to (ignored except if array)
Returns:
The converted object
Throws:
TypeConversionException - If the string is longer than one character or the type is an array and the value is invalid