org.springframework.data.convert.CustomConversions Java Examples

The following examples show how to use org.springframework.data.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 flow-platform-x with Apache License 2.0 6 votes vote down vote up
@Override
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();

    VariableMapConverter variableConverter = new VariableMapConverter(objectMapper);
    converters.add(variableConverter.getReader());
    converters.add(variableConverter.getWriter());

    EncryptConverter encryptConverter = new EncryptConverter(appProperties.getSecret());
    converters.add(encryptConverter.new SimpleKeyPairReader());
    converters.add(encryptConverter.new SimpleKeyPairWriter());
    converters.add(encryptConverter.new SimpleAuthPairReader());
    converters.add(encryptConverter.new SimpleAuthPairWriter());

    converters.add(new JobItem.ContextReader());
    return new MongoCustomConversions(converters);
}
 
Example #2
Source File: MongoConfig.java    From flow-platform-x with Apache License 2.0 6 votes vote down vote up
@Override
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();

    VariableMapConverter variableConverter = new VariableMapConverter(objectMapper);
    converters.add(variableConverter.getReader());
    converters.add(variableConverter.getWriter());

    EncryptConverter encryptConverter = new EncryptConverter(appProperties.getSecret());
    converters.add(encryptConverter.new SimpleKeyPairReader());
    converters.add(encryptConverter.new SimpleKeyPairWriter());
    converters.add(encryptConverter.new SimpleAuthPairReader());
    converters.add(encryptConverter.new SimpleAuthPairWriter());
    converters.add(encryptConverter.new SimpleTokenReader());
    converters.add(encryptConverter.new SimpleTokenWriter());

    converters.add(new JobItem.ContextReader());
    return new MongoCustomConversions(converters);
}
 
Example #3
Source File: DefaultArangoConverter.java    From spring-data with Apache License 2.0 5 votes vote down vote up
public DefaultArangoConverter(
	final MappingContext<? extends ArangoPersistentEntity<?>, ArangoPersistentProperty> context,
	final CustomConversions conversions, final ResolverFactory resolverFactory, final ArangoTypeMapper typeMapper) {

	this.context = context;
	this.conversions = conversions;
	this.resolverFactory = resolverFactory;
	this.typeMapper = typeMapper;
	conversionService = new DefaultConversionService();
	conversions.registerConvertersIn(conversionService);
	instantiators = new EntityInstantiators();
}
 
Example #4
Source File: TwoStepsConversions.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
public TwoStepsConversions(CustomConversions customConversions,
		ObjectToKeyFactory objectToKeyFactory, DatastoreMappingContext datastoreMappingContext) {
	this.objectToKeyFactory = objectToKeyFactory;
	this.datastoreMappingContext = datastoreMappingContext;
	this.conversionService = new DefaultConversionService();
	this.internalConversionService = new DefaultConversionService();
	this.customConversions = customConversions;
	this.customConversions.registerConvertersIn(this.conversionService);

	this.internalConversionService.addConverter(BYTE_ARRAY_TO_BLOB_CONVERTER);
	this.internalConversionService.addConverter(BLOB_TO_BYTE_ARRAY_CONVERTER);
}
 
Example #5
Source File: SpannerCustomConverter.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * @param customConversions must not be null.
 * @param conversionService if null, then {@link DefaultConversionService} is used.
 */
SpannerCustomConverter(CustomConversions customConversions,
															GenericConversionService conversionService) {
	Assert.notNull(customConversions, "Valid custom conversions are required!");
	this.conversionService = (conversionService != null) ? conversionService : new DefaultConversionService();

	customConversions.registerConvertersIn(this.conversionService);
}
 
Example #6
Source File: MongodbConfig.java    From jakduk-api with MIT License 5 votes vote down vote up
@Override
public CustomConversions customConversions() {
    List<Converter<?, ?>> converters = new ArrayList<>();
    converters.add(new DateToLocalDateTimeConverter());
    converters.add(new LocalDateTimeToDateConverter());
    return new MongoCustomConversions(converters);
}
 
Example #7
Source File: ArangoConfiguration.java    From spring-data with Apache License 2.0 4 votes vote down vote up
default CustomConversions customConversions() {
	return new ArangoCustomConversions(customConverters());
}
 
Example #8
Source File: SpannerCustomConverter.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
static CustomConversions getCustomConversions(
				Collection<Converter> converters) {
	return new CustomConversions(CustomConversions.StoreConversions.NONE, converters);
}
 
Example #9
Source File: SpannerWriteConverter.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
public SpannerWriteConverter(CustomConversions customConversions) {
	this(customConversions, null);
}
 
Example #10
Source File: SpannerWriteConverter.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
public SpannerWriteConverter(CustomConversions customConversions, GenericConversionService conversionService) {
	super(customConversions, conversionService);
}
 
Example #11
Source File: SpannerReadConverter.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
public SpannerReadConverter(CustomConversions customConversions) {
	this(customConversions, null);
}
 
Example #12
Source File: SpannerReadConverter.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
public SpannerReadConverter(CustomConversions customConversions, GenericConversionService conversionService) {
	super(customConversions, conversionService);
}
 
Example #13
Source File: AbstractVaultConverter.java    From spring-vault with Apache License 2.0 2 votes vote down vote up
/**
 * Registers the given custom conversions with the converter.
 * @param conversions
 */
public void setCustomConversions(CustomConversions conversions) {
	this.conversions = conversions;
}