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

The following examples show how to use org.springframework.core.convert.converter.ConditionalGenericConverter. 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: GenericConversionService.java    From spring-analysis-note with 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 File: GenericConversionService.java    From java-technology-stack with 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
Source File: GenericConversionService.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: GenericConversionService.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
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
Source File: EntityFormatAnnotationFormatterFactory.java    From springlets with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}