Java Code Examples for org.springframework.format.FormatterRegistry#addConverter()
The following examples show how to use
org.springframework.format.FormatterRegistry#addConverter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebMvcConfigurationSupportExtensionTests.java From java-technology-stack with MIT License | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new Converter<TestBean, String>() { @Override public String convert(TestBean source) { return "converted"; } }); }
Example 2
Source File: DateTimeFormatConfiguration.java From spring-cloud-gray with Apache License 2.0 | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); registrar.setUseIsoFormat(true); registrar.registerFormatters(registry); registry.addConverter(new StringToDateConverter()); }
Example 3
Source File: WebConfig.java From tutorials with MIT License | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToEmployeeConverter()); registry.addConverter(new StringToEnumConverter()); registry.addConverterFactory(new StringToAbstractEntityConverterFactory()); registry.addConverter(new GenericBigDecimalConverter()); }
Example 4
Source File: WebMvcConfigurationSupportExtensionTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new Converter<TestBean, String>() { @Override public String convert(TestBean source) { return "converted"; } }); }
Example 5
Source File: WebMvcConfigurationSupportExtensionTests.java From spring-analysis-note with MIT License | 5 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new Converter<TestBean, String>() { @Override public String convert(TestBean source) { return "converted"; } }); }
Example 6
Source File: DispatcherServletConfiguration.java From find with MIT License | 5 votes |
@Override public void addFormatters(final FormatterRegistry registry) { if(converters != null) { for(final Converter<?, ?> converter : converters) { registry.addConverter(converter); } } registry.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory()); }
Example 7
Source File: WebMvcConfig.java From konker-platform with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(instantToStringConverter()); }
Example 8
Source File: DataApiV3Config.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(selectionConverter()); }
Example 9
Source File: RestConfig.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(attributeFilterConverter()); registry.addConverter(sortConverter()); registry.addConverter(aggregateQueryRsqlConverter()); }
Example 10
Source File: MvcConfig.java From tutorials with MIT License | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToEnumConverter()); }
Example 11
Source File: RsqlConfig.java From molgenis with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(rsqlQueryConverter()); }
Example 12
Source File: ApplicationConversionServiceFactoryBean.java From JDeSurvey with GNU Affero General Public License v3.0 | 4 votes |
public void installLabelConverters(FormatterRegistry registry) { registry.addConverter(getSurveyToStringConverter()); registry.addConverter(getIdToSurveyConverter()); registry.addConverter(getStringToSurveyConverter()); }
Example 13
Source File: WebConfig.java From tutorials with MIT License | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToEmployeeConverter()); registry.addConverterFactory(new StringToEnumConverterFactory()); registry.addConverter(new GenericBigDecimalConverter()); }
Example 14
Source File: EtfFormatterRegistrar.java From etf-webapp with European Union Public License 1.2 | 4 votes |
private static void addConverter(final FormatterRegistry registry, final EtfConverter converter) { registry.addConverter(converter.strToTypeConverter()); registry.addConverter(converter.typeToStrConverter()); registry.addFormatter(converter); }
Example 15
Source File: FriendlyIdConfiguration.java From friendly-id with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToUuidConverter()); registry.addConverter(new UuidToStringConverter()); }
Example 16
Source File: SpringConfig.java From spring-boot-start-current with Apache License 2.0 | 4 votes |
/** * 添加转换器 * * @param registry */ @Override public void addFormatters ( FormatterRegistry registry ) { // 从前台过来的数据转换成对应类型的转换器,但是对 @RequestBody 注解的参数无效 registry.addConverter( new StringToDateConverter() ); }
Example 17
Source File: BaseApplicationConfig.java From spring-boot-doma2-sample with Apache License 2.0 | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new LocalDateConverter(LOCALDATE_FORMAT)); registry.addConverter(new LocalDateTimeConverter(LOCALDATETIME_FORMAT)); }
Example 18
Source File: WebConfig.java From new-bull with MIT License | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToUserConverter()); }
Example 19
Source File: WebMvcConfig.java From zfile with MIT License | 4 votes |
@Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StorageTypeEnumDeSerializerConvert()); }
Example 20
Source File: ApplicationConversionServiceFactoryBean.java From JDeSurvey with GNU Affero General Public License v3.0 | 2 votes |
public void installLabelConverters(FormatterRegistry registry) { registry.addConverter(getVelocityTemplateToStringConverter()); registry.addConverter(getIdToVelocityTemplateConverter()); registry.addConverter(getStringToVelocityTemplateConverter()); registry.addConverter(getDepartmentToStringConverter()); registry.addConverter(getIdToDepartmentConverter()); registry.addConverter(getStringToDepartmentConverter()); registry.addConverter(getSurveyDefinitionToStringConverter()); registry.addConverter(getIdToSurveyDefinitionConverter()); registry.addConverter(getStringToSurveyDefinitionConverter()); registry.addConverter(getQuestionOptionToStringConverter()); registry.addConverter(getIdToQuestionOptionConverter()); registry.addConverter(getStringToQuestionOptionConverter()); registry.addConverter(getQuestionTypeToStringConverter()); registry.addConverter(getStringToQuestionTypeConverter()); registry.addConverter(getQuestionToStringConverter()); registry.addConverter(getIdToQuestionConverter()); registry.addConverter(getStringToQuestionConverter()); registry.addConverter(getSurveyDefinitionPageToStringConverter()); registry.addConverter(getIdToSurveyDefinitionPageConverter()); registry.addConverter(getStringToSurveyDefinitionPageConverter()); registry.addConverter(getUserToStringConverter()); registry.addConverter(getIdToUserConverter()); registry.addConverter(getStringToUserConverter()); registry.addConverter(getGroupToStringConverter()); registry.addConverter(getIdToGroupConverter()); registry.addConverter(getStringToGroupConverter()); registry.addConverter(getAuthorityToStringConverter()); registry.addConverter(getIdToAuthorityConverter()); registry.addConverter(getStringToAuthorityConverter()); registry.addConverter(getDataSetToStringConverter()); registry.addConverter(getIdToDataSetConverter()); registry.addConverter(getStringToDataSetConverter()); registry.addConverter(getDataSetItemToStringConverter()); registry.addConverter(getIdToDataSetItemConverter()); registry.addConverter(getStringToDataSetItemConverter()); registry.addConverter(getRegularExpressionToStringConverter()); registry.addConverter(getIdToRegularExpressionConverter()); registry.addConverter(getStringToRegularExpressionConverter()); //custom DateTimeFormatter DateTimeFormatAnnotationFormatterFactory dateTimeFormatAnnotationFormatterFactory = new DateTimeFormatAnnotationFormatterFactory(); dateTimeFormatAnnotationFormatterFactory.setApplicationContext(applicationContext); registry.addFormatterForFieldAnnotation(dateTimeFormatAnnotationFormatterFactory); registry.addConverter(geGroupingOperatorToStringConverter()); registry.addConverter(getStringToGroupingOperatorConverter()); registry.addConverter(getLogicOperatorToStringConverter()); registry.addConverter(getStringLogicOperatorTypeConverter()); registry.addConverter(getSectorToStringConverter()); registry.addConverter(getIdToSectorConverter()); registry.addConverter(getStringToSectorConverter()); registry.addConverter(getSurveyTemplateToStringConverter()); registry.addConverter(getIdToSurveyTemplateConverter()); registry.addConverter(getStringToSurveyTemplateConverter()); registry.addConverter(getDayToStringConverter()); registry.addConverter(getIdToDayConverter()); registry.addConverter(getStringToDayConverter()); registry.addConverter(getGlobalSettingsToStringConverter()); registry.addConverter(getIdToGlobalSettingsConverter()); registry.addConverter(getStringToGlobalSettingsConverter()); }