Home » tapestry-src-5.0.19 » org.apache.tapestry5.ioc.services » [javadoc | source]
public interface: TypeCoercer [javadoc | source]

All Known Implementing Classes:

Makes use of org.apache.tapestry5.ioc.services.Coercion s to convert between an input value (of some specific type) and a desired output type. Smart about coercing, even if it requires multiple coercion steps (i.e., via an intermediate type, such as String).
Method from org.apache.tapestry5.ioc.services.TypeCoercer Summary:
clearCache,   coerce,   explain
Method from org.apache.tapestry5.ioc.services.TypeCoercer Detail:
 public  void clearCache()
    Clears cached information stored by the TypeCoercer.
 public T coerce(S input,
    Class<T> targetType)
    Performs a coercion from an input type to a desired output type. When the target type is a primitive, the actual conversion will be to the equivalent wrapper type. In some cases, the TypeCoercer will need to search for an appropriate coercion, and may even combine existing coercions to form new ones; in those cases, the results of the search are cached.

    The TypeCoercer also caches the results of a coercion search.

 public String explain(Class<S> inputType,
    Class<T> targetType)
    Used primarily inside test suites, this method performs the same steps as #coerce(Object, Class) , but returns a string describing the series of coercision, such as "Object --> String --> Long --> Integer".