Class AbstractStandardConversionService

Object
org.thymeleaf.standard.expression.AbstractStandardConversionService
All Implemented Interfaces:
IStandardConversionService
Direct Known Subclasses:
StandardConversionService

public abstract class AbstractStandardConversionService extends Object implements IStandardConversionService

Base abstract class meant to be extended by most implementations of the IStandardConversionService interface.

This abstract class separates the to-String conversions (the most common) and the rest of them.

Since:
2.1.0
Author:
Daniel Fernández
  • Constructor Details

    • AbstractStandardConversionService

      protected AbstractStandardConversionService()
  • Method Details

    • convert

      public final <T> T convert(IExpressionContext context, Object object, Class<T> targetClass)
      Description copied from interface: IStandardConversionService

      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.

      Specified by:
      convert in interface IStandardConversionService
      Type Parameters:
      T - the type of the target class
      Parameters:
      context - the context object.
      object - the object to be converted.
      targetClass - the target class the object should be converted to.
      Returns:
      the object, converted. Or an exception if the conversion has not been possible.
    • convertToString

      protected String convertToString(IExpressionContext context, Object object)
    • convertOther

      protected <T> T convertOther(IExpressionContext context, Object object, Class<T> targetClass)