org.springframework.data.mongodb.core.convert.CustomConversions Java Examples

The following examples show how to use org.springframework.data.mongodb.core.convert.CustomConversions. 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: MongoConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Override
@Bean
public MappingMongoConverter mappingMongoConverter() throws Exception {
    DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(this.dbFactory());
    MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, this.mongoMappingContext());
    List<Object> list = new ArrayList<>();
    list.add(new BigDecimalToDecimal128Converter());//自定义的类型转换器
    list.add(new Decimal128ToBigDecimalConverter());//自定义的类型转换器
    //list.add(new DateLocalConvert());
    converter.setCustomConversions(new CustomConversions(list));
    return converter;
}
 
Example #2
Source File: MongoDbConfiguration.java    From moserp with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<Converter<?, ?>>();
    converterList.add(new BigDecimalWrapperToStringConverter());
    converterList.add(new StringToQuantityConverter());
    converterList.add(new StringToPriceConverter());
    converterList.add(new RestUriToStringConverter());
    converterList.add(new StringToRestUriConverter());
    return new CustomConversions(converterList);
}
 
Example #3
Source File: CloudDatabaseConfiguration.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<>();
    converterList.add(DateToZonedDateTimeConverter.INSTANCE);
    converterList.add(ZonedDateTimeToDateConverter.INSTANCE);
    return new CustomConversions(converterList);
}
 
Example #4
Source File: DatabaseConfiguration.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();
    converters.add(DateToZonedDateTimeConverter.INSTANCE);
    converters.add(ZonedDateTimeToDateConverter.INSTANCE);
    return new CustomConversions(converters);
}
 
Example #5
Source File: MongoConfiguration.java    From microservices-springboot with MIT License 5 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();
    converters.add(new DateToZonedDateTimeConverter());
    converters.add(new ZonedDateTimeToDateConverter());
    return new CustomConversions(converters);
}
 
Example #6
Source File: MongoConfiguration.java    From spring-cloud-event-sourcing-example with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@Override
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<>();
    converterList.add(new LongToDateTimeConverter());
    converterList.add(new StringToDateTimeConverter());
    return new CustomConversions(converterList);
}
 
Example #7
Source File: MongoConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@Override
@Bean
public MappingMongoConverter mappingMongoConverter() throws Exception {
    DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(this.dbFactory());
    MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, this.mongoMappingContext());
    List<Object> list = new ArrayList<>();
    list.add(new BigDecimalToDecimal128Converter());//自定义的类型转换器
    list.add(new Decimal128ToBigDecimalConverter());//自定义的类型转换器
    //list.add(new DateLocalConvert());
    converter.setCustomConversions(new CustomConversions(list));
    return converter;
}
 
Example #8
Source File: _DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();<% if (authenticationType == 'oauth2') { %>
    converters.add(new OAuth2AuthenticationReadConverter());<% } %>
    converters.add(DateToZonedDateTimeConverter.INSTANCE);
    converters.add(ZonedDateTimeToDateConverter.INSTANCE);
    converters.add(DateToLocalDateConverter.INSTANCE);
    converters.add(LocalDateToDateConverter.INSTANCE);
    converters.add(DateToLocalDateTimeConverter.INSTANCE);
    converters.add(LocalDateTimeToDateConverter.INSTANCE);
    return new CustomConversions(converters);
}
 
Example #9
Source File: _CloudMongoDbConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<>();;<% if (authenticationType == 'oauth2') { %>
    converterList.add(new OAuth2AuthenticationReadConverter());<% } %>
    converterList.add(DateToZonedDateTimeConverter.INSTANCE);
    converterList.add(ZonedDateTimeToDateConverter.INSTANCE);
    converterList.add(DateToLocalDateConverter.INSTANCE);
    converterList.add(LocalDateToDateConverter.INSTANCE);
    converterList.add(DateToLocalDateTimeConverter.INSTANCE);
    converterList.add(LocalDateTimeToDateConverter.INSTANCE);
    return new CustomConversions(converterList);
}
 
Example #10
Source File: MongoAuditConfig.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CustomConversions customConversions() {
    return new CustomConversions(converters);
}
 
Example #11
Source File: ParksAppConfig.java    From nationalparks with Apache License 2.0 4 votes vote down vote up
@Bean
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<Converter<?, ?>>();
    converterList.add(new ParkReadConverter());
    return new CustomConversions(converterList);
}
 
Example #12
Source File: MongoPrivateStorageConfig.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CustomConversions customConversions() {
    return new CustomConversions(converters);
}
 
Example #13
Source File: MongoBillingConfig.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CustomConversions customConversions() {
    return new CustomConversions(converters);
}
 
Example #14
Source File: MongoConfig.java    From konker-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CustomConversions customConversions() {
    return new CustomConversions(converters);
}
 
Example #15
Source File: StatisticsApplication.java    From piggymetrics with MIT License 4 votes vote down vote up
@Bean
public CustomConversions customConversions() {
	return new CustomConversions(Arrays.asList(new DataPointIdReaderConverter(),
			new DataPointIdWriterConverter()));
}
 
Example #16
Source File: NotificationServiceApplication.java    From piggymetrics with MIT License 4 votes vote down vote up
@Bean
public CustomConversions customConversions() {
	return new CustomConversions(Arrays.asList(new FrequencyReaderConverter(),
			new FrequencyWriterConverter()));
}
 
Example #17
Source File: MongoPersistenceConfiguration.java    From omh-dsu-ri with Apache License 2.0 3 votes vote down vote up
@Override
public CustomConversions customConversions() {

    List<Converter<?, ?>> converters = new ArrayList<>();

    converters.add(new OffsetDateTimeToStringConverter());
    converters.add(new StringToOffsetDateTimeConverter());

    return new CustomConversions(converters);
}