|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.ioc.internal.util.LockSupport org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl
public class TypeCoercerImpl
Constructor Summary | |
---|---|
TypeCoercerImpl(Collection<CoercionTuple> tuples)
|
Method Summary | ||
---|---|---|
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. |
|
|
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". |
|
|
getCoercion(Class<S> sourceType,
Class<T> targetType)
Given a source and target type, computes the coercion that will be used. |
Methods inherited from class org.apache.tapestry5.ioc.internal.util.LockSupport |
---|
acquireReadLock, downgradeWriteLockToReadLock, releaseReadLock, releaseWriteLock, takeWriteLock, upgradeReadLockToWriteLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeCoercerImpl(Collection<CoercionTuple> tuples)
Method Detail |
---|
public Object coerce(Object input, Class targetType)
TypeCoercer
coerce
in interface TypeCoercer
targetType
- defines the target type
public <S,T> Coercion<S,T> getCoercion(Class<S> sourceType, Class<T> targetType)
TypeCoercer
Note: holding the returned coercion past the time when the cache is cleared can cause a memory leak, especially in the context of live reloading (wherein holding a reference to a single class make keep an entire ClassLoader from being reclaimed).
getCoercion
in interface TypeCoercer
S
- source type (input)T
- target type (output)sourceType
- type to coerce fromtargetType
- defines the target type
public <S,T> String explain(Class<S> sourceType, Class<T> targetType)
TypeCoercer
TypeCoercer.coerce(Object, Class)
, but
returns a string describing the series of coercions, such as "Object --> String --> Long --> Integer".
explain
in interface TypeCoercer
S
- source type (input)T
- target type (output)sourceType
- the source coercion type (use void.class for coercions from null)targetType
- defines the target type
public void clearCache()
TypeCoercer
clearCache
in interface TypeCoercer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |