public class TypeCoercerImpl extends LockSupport implements TypeCoercer
| Constructor and Description |
|---|
TypeCoercerImpl(java.util.Collection<CoercionTuple> tuples) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clears cached information stored by the TypeCoercer.
|
java.lang.Object |
coerce(java.lang.Object input,
java.lang.Class targetType)
Performs a coercion from an input type to a desired output type.
|
<S,T> java.lang.String |
explain(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType)
Used primarily inside test suites, this method performs the same steps as
TypeCoercer.coerce(Object, Class), but
returns a string describing the series of coercions, such as "Object --> String --> Long --> Integer". |
<S,T> Coercion<S,T> |
getCoercion(java.lang.Class<S> sourceType,
java.lang.Class<T> targetType)
Given a source and target type, computes the coercion that will be used.
|
acquireReadLock, downgradeWriteLockToReadLock, releaseReadLock, releaseWriteLock, takeWriteLock, upgradeReadLockToWriteLockpublic TypeCoercerImpl(java.util.Collection<CoercionTuple> tuples)
public java.lang.Object coerce(java.lang.Object input, java.lang.Class targetType)
TypeCoercercoerce in interface TypeCoercertargetType - defines the target typepublic <S,T> Coercion<S,T> getCoercion(java.lang.Class<S> sourceType, java.lang.Class<T> targetType)
TypeCoercergetCoercion in interface TypeCoercerS - source type (input)T - target type (output)sourceType - type to coerce fromtargetType - defines the target typepublic <S,T> java.lang.String explain(java.lang.Class<S> sourceType, java.lang.Class<T> targetType)
TypeCoercerTypeCoercer.coerce(Object, Class), but
returns a string describing the series of coercions, such as "Object --> String --> Long --> Integer".explain in interface TypeCoercerS - source type (input)T - target type (output)sourceType - the source coercion type (use void.class for coercions from null)targetType - defines the target typepublic void clearCache()
TypeCoercerclearCache in interface TypeCoercer${project.version} - Copyright © 2003-2015 The Apache Software Foundation.