|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.util.coerce.CoercionHandler
An abstract class to allow extending the default behavior of
Objects.coerce(Object,Class)
when it is
not possible to implement Coercible
directly in the target class or where coercion is desired from
an unrelated class. Also provides a registry for all of the
currently installed handlers.
Constructor Summary | |
CoercionHandler()
|
Method Summary | |
abstract Object |
coerce(Object value,
Class type)
Coerce the given value into the specified type. |
static CoercionHandler |
create(Class type)
Create a CoercionHandler for the given class type. |
Class |
getType()
Get the target class type for this CoercionHandler. |
static void |
install(BoundCoercionHandler handler)
Install a BoundCoercionHandler. |
static void |
install(Class type,
CoercionHandler handler)
Install a CoercionHandler for a given class type. |
static boolean |
isInstalled(Class type)
Check if there is a CoercionHandler installed for the given class. |
static CoercionHandler |
lookup(Class type)
Lookup the CoercionHandler for a given class. |
static void |
uninstall(Class type)
Uninstall a CoercionHandler for a given class type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CoercionHandler()
Method Detail |
public abstract Object coerce(Object value, Class type) throws CoercionException
value
- Value to coercetype
- Object type to coerce into
CoercionException
- Failed to coercepublic Class getType()
NotImplementedException
- Handler is not boundpublic static void install(Class type, CoercionHandler handler)
handler
- Coercion handler
NullArgumentException
- type or handlerpublic static void install(BoundCoercionHandler handler)
handler
- Bound coercion handler
NullArgumentException
- handlerpublic static void uninstall(Class type)
type
- Class type
NullArgumentException
- typepublic static boolean isInstalled(Class type)
type
- Class type
public static CoercionHandler lookup(Class type)
type
- Class type
NullArgumentException
- typepublic static CoercionHandler create(Class type)
type
- Class type
CoercionException
- No installed handler for type
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |