站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

CharacterHandler (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util.coerce
Class CharacterHandler

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

public class CharacterHandler
extends BoundCoercionHandler

A Character coercion handler.

Version:
$Revision: 1.1 $
Author:
Jason Dillon

Constructor Summary
CharacterHandler()
           
 
Method Summary
 Object coerce(Object value, Class type)
          Coerces the given value into the given type (which should be Character.class).
 Object coerce(String value)
          Coerces the given string into a Character, by taking off the first index of the string and wrapping it.
 Class getType()
          Get the target class type for this CoercionHandler.
 
Methods inherited from class org.jboss.util.coerce.CoercionHandler
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 Class getType()
Get the target class type for this CoercionHandler.

Specified by:
getType in class BoundCoercionHandler
Returns:
Class type

coerce

public Object coerce(Object value,
                     Class type)
              throws CoercionException
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
Parameters:
value - Value to coerce
type - Character.class
Returns:
Value coerced into a Character
Throws:
CoercionException - Failed to coerce

coerce

public Object coerce(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.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.