Java Code Examples for org.springframework.core.convert.converter.ConditionalGenericConverter

The following examples show how to use org.springframework.core.convert.converter.ConditionalGenericConverter. These examples are extracted from open source projects. 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 Project: spring-analysis-note   Source File: GenericConversionService.java    License: MIT License 5 votes vote down vote up
@Nullable
public GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
	for (GenericConverter converter : this.converters) {
		if (!(converter instanceof ConditionalGenericConverter) ||
				((ConditionalGenericConverter) converter).matches(sourceType, targetType)) {
			return converter;
		}
	}
	return null;
}
 
Example 2
Source Project: java-technology-stack   Source File: GenericConversionService.java    License: MIT License 5 votes vote down vote up
@Nullable
public GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
	for (GenericConverter converter : this.converters) {
		if (!(converter instanceof ConditionalGenericConverter) ||
				((ConditionalGenericConverter) converter).matches(sourceType, targetType)) {
			return converter;
		}
	}
	return null;
}
 
Example 3
public GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
	for (GenericConverter converter : this.converters) {
		if (!(converter instanceof ConditionalGenericConverter) ||
				((ConditionalGenericConverter) converter).matches(sourceType, targetType)) {
			return converter;
		}
	}
	return null;
}
 
Example 4
public GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
	for (GenericConverter converter : this.converters) {
		if (!(converter instanceof ConditionalGenericConverter) ||
				((ConditionalGenericConverter) converter).matches(sourceType, targetType)) {
			return converter;
		}
	}
	return null;
}
 
Example 5
/**
 * Creates a converter of entities to {@link String}, based on the {@link EntityFormat}
 * annotation provided at the class level.
 * 
 * @return the entity to String converter
 */
public ConditionalGenericConverter getToStringConverter() {
  return new EntityToStringConverter(PARSER, PARSER_CONTEXT, messageSource, conversionService);
}