当前位置: 首页>>代码示例>>Java>>正文


Java GenericConversionService.addConverterFactory方法代码示例

本文整理汇总了Java中org.springframework.core.convert.support.GenericConversionService.addConverterFactory方法的典型用法代码示例。如果您正苦于以下问题:Java GenericConversionService.addConverterFactory方法的具体用法?Java GenericConversionService.addConverterFactory怎么用?Java GenericConversionService.addConverterFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.convert.support.GenericConversionService的用法示例。


在下文中一共展示了GenericConversionService.addConverterFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerConvertersIn

import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
 * Register custom converters within given {@link org.springframework.core.convert.support.GenericConversionService}
 *
 * @param conversionService must not be null
 */
public void registerConvertersIn(GenericConversionService conversionService) {
	Assert.notNull(conversionService);

	for (Object converter : converters) {
		if (converter instanceof Converter) {
			conversionService.addConverter((Converter<?, ?>) converter);
		} else if (converter instanceof ConverterFactory) {
			conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
		} else if (converter instanceof GenericConverter) {
			conversionService.addConverter((GenericConverter) converter);
		} else {
			throw new IllegalArgumentException("Given object '" + converter
					+ "' expected to be a Converter, ConverterFactory or GenericeConverter!");
		}
	}
}
 
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:22,代码来源:CustomConversions.java

示例2: registerConvertersIn

import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
 * Populates the given {@link GenericConversionService} with the converters registered.
 *
 * @param conversionService the service to register.
 */
public void registerConvertersIn(final GenericConversionService conversionService) {
  for (Object converter : converters) {
    boolean added = false;

    if (converter instanceof Converter) {
      conversionService.addConverter((Converter<?, ?>) converter);
      added = true;
    }

    if (converter instanceof ConverterFactory) {
      conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
      added = true;
    }

    if (converter instanceof GenericConverter) {
      conversionService.addConverter((GenericConverter) converter);
      added = true;
    }

    if (!added) {
      throw new IllegalArgumentException("Given set contains element that is neither Converter nor ConverterFactory!");
    }
  }
}
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:30,代码来源:CustomConversions.java

示例3: registerConvertersIn

import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
 * Register custom converters within given {@link GenericConversionService}
 * 
 * @param conversionService must not be null
 */
public void registerConvertersIn(GenericConversionService conversionService) {
	Assert.notNull(conversionService);

	for (Object converter : converters) {
		if (converter instanceof Converter) {
			conversionService.addConverter((Converter<?, ?>) converter);
		} else if (converter instanceof ConverterFactory) {
			conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
		} else if (converter instanceof GenericConverter) {
			conversionService.addConverter((GenericConverter) converter);
		} else {
			throw new IllegalArgumentException("Given object '" + converter
					+ "' expected to be a Converter, ConverterFactory or GenericeConverter!");
		}
	}
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:22,代码来源:CustomConversions.java

示例4: registerConvertersIn

import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
 * Populates the given {@link GenericConversionService} with the convertes registered.
 *
 * @param conversionService
 */
public void registerConvertersIn(GenericConversionService conversionService) {

    for (Object converter : converters) {

        boolean added = false;

        if (converter instanceof Converter) {
            conversionService.addConverter((Converter<?, ?>) converter);
            added = true;
        }

        if (converter instanceof ConverterFactory) {
            conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
            added = true;
        }

        if (converter instanceof GenericConverter) {
            conversionService.addConverter((GenericConverter) converter);
            added = true;
        }

        if (!added) {
            throw new IllegalArgumentException(
                    "Given set contains element that is neither Converter nor ConverterFactory!");
        }
    }
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:33,代码来源:CustomConversions.java


注:本文中的org.springframework.core.convert.support.GenericConversionService.addConverterFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。