Example usage for org.springframework.core.convert.support DefaultConversionService addDefaultConverters

List of usage examples for org.springframework.core.convert.support DefaultConversionService addDefaultConverters

Introduction

In this page you can find the example usage for org.springframework.core.convert.support DefaultConversionService addDefaultConverters.

Prototype

public static void addDefaultConverters(ConverterRegistry converterRegistry) 

Source Link

Document

Add converters appropriate for most environments.

Usage

From source file:org.ldaptive.beans.spring.SpringLdapEntryMapper.java

/**
 * Creates an evaluation context to use in the spring class descriptor. Adds
 * the default converters from the default conversion service.
 *
 * @param  object  to supply to the evaluation context
 *
 * @return  evalutation context/*from ww  w .j a  va2  s. c om*/
 */
protected EvaluationContext createEvaluationContext(final Object object) {
    final GenericConversionService conversionService = new GenericConversionService();
    DefaultConversionService.addDefaultConverters(conversionService);
    if (converters != null) {
        for (Converter<?, ?> converter : converters) {
            conversionService.addConverter(converter);
        }
    }
    addDefaultConverters(conversionService);

    final StandardEvaluationContext context = new StandardEvaluationContext(object);
    context.setTypeConverter(new StandardTypeConverter(conversionService));
    return context;
}