public interface IStandardConversionService
Common interface for all implementations of a conversion service, to be used during template execution.
Thymeleaf conversion services work in a way similar to Spring Framework's ConversionService interface, but this is a generic mechanism (not dependent on Spring).
Default implementation —registered by
StandardConversionService, which performs some standard conversions, but the
Spring Standard Dialect used by the Thymeleaf + Spring integration module automatically registers an implementation
of this interface that delegates on any existing Spring ConversionService objects (thus using
the Converters and Formatters regitered at the Spring Application Context).
Important: there is one conversion that implementations of this interface should always implement, because it is heavily used at the Thymeleaf core: conversion of any Object to String.
The implementation of this interface that should be used is specified as an execution attribute
by the Standard Dialects (see
Implementations of this interface should be thread-safe.
<T> T convert(Configuration configuration, IProcessingContext processingContext, Object object, Class<T> targetClass)
Convert a value to the specified target class, if possible.
Might raise an exception (usually
IllegalArgumentException) if a conversion is not available
for the specified object and the target class.
T- the type of the target class
configuration- the Configuration object for the template execution environment.
processingContext- the processing context object containing the variables to be applied to the expression.
object- the object to be converted.
targetClass- the target class the object should be converted to.
Copyright © 2017 The THYMELEAF team. All rights reserved.