public class TypeCoercerImpl extends LockSupport implements TypeCoercer
| Constructor and Description |
|---|
TypeCoercerImpl(Collection<CoercionTuple> tuples) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clears cached information stored by the TypeCoercer.
|
Object |
coerce(Object input,
Class targetType)
Performs a coercion from an input type to a desired output type.
|
<S,T> String |
explain(Class<S> sourceType,
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(Class<S> sourceType,
Class<T> targetType)
Given a source and target type, computes the coercion that will be used.
|
acquireReadLock, downgradeWriteLockToReadLock, releaseReadLock, releaseWriteLock, takeWriteLock, upgradeReadLockToWriteLockpublic TypeCoercerImpl(Collection<CoercionTuple> tuples)
public Object coerce(Object input, Class targetType)
TypeCoercercoerce in interface TypeCoercertargetType - defines the target typepublic <S,T> Coercion<S,T> getCoercion(Class<S> sourceType, 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> String explain(Class<S> sourceType, 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 TypeCoercer5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.