org.jboss.util.coerce
Class CharacterHandler

java.lang.Object
  extended byorg.jboss.util.coerce.CoercionHandler (src) 
      extended byorg.jboss.util.coerce.BoundCoercionHandler (src) 
          extended byorg.jboss.util.coerce.CharacterHandler

public class CharacterHandler
extends BoundCoercionHandler (src)

A Character coercion handler.


Constructor Summary
CharacterHandler()
           
 
Method Summary
 java.lang.Object coerce(java.lang.Object value, java.lang.Class type)
          Coerces the given value into the given type (which should be Character.class).
 java.lang.Object coerce(java.lang.String value)
          Coerces the given string into a Character, by taking off the first index of the string and wrapping it.
 java.lang.Class getType()
          Get the target class type for this CoercionHandler.
 
Methods inherited from class org.jboss.util.coerce.CoercionHandler (src)
create, install, install, isInstalled, lookup, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterHandler

public CharacterHandler()
Method Detail

getType

public java.lang.Class getType()
Get the target class type for this CoercionHandler.

Specified by:
getType in class BoundCoercionHandler (src)
Returns:
Class type

coerce

public java.lang.Object coerce(java.lang.Object value,
                               java.lang.Class type)
                        throws CoercionException (src) 
Coerces the given value into the given type (which should be Character.class).

This currently only support coercion from a String.

Specified by:
coerce in class CoercionHandler (src)
Parameters:
value - Value to coerce
type - Character.class
Returns:
Value coerced into a Character
Throws:
CoercionException (src) - Failed to coerce

coerce

public java.lang.Object coerce(java.lang.String value)
Coerces the given string into a Character, by taking off the first index of the string and wrapping it.

Parameters:
value - String value to convert to a Character
Returns:
Character value or null if the string is empty.