Spring Framework DefaultFormattingConversionService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework DefaultFormattingConversionService class.

This code example shows how to use the following methods:
		return config;
	} 
 
	@Bean 
	public DefaultFormattingConversionService defaultConversionService() {
		return new DefaultFormattingConversionService();
	} 
 
	@Bean 
	public DomainClassConverter<?> domainClassConverter() { 
		return new DomainClassConverter<DefaultFormattingConversionService>(defaultConversionService());
	} 
 
	@Bean 
	public PersistentEntities persistentEntities() { 
		return new PersistentEntities(mappingContexts);
	} 
 
	@Bean 
	public UriToEntityConverter uriToEntityConverter() { 
6
CodeRank
This code example shows how to use the following methods:
	 * @param contributors a collection of {@link UriComponentsContributor} 
	 * or {@link HandlerMethodArgumentResolver}s. 
	 */ 
	public CompositeUriComponentsContributor(UriComponentsContributor... contributors) {
		Collections.addAll(this.contributors, contributors);
		this.conversionService = new DefaultFormattingConversionService();
	} 
 
	/** 
	 * Create an instance from a collection of {@link UriComponentsContributor}s or 
	 * {@link HandlerMethodArgumentResolver}s. Since both of these tend to be implemented 
	 * by the same class, the most convenient option is to obtain the configured 
	 * {@code HandlerMethodArgumentResolvers} in {@code RequestMappingHandlerAdapter} 
	 * and provide that to this constructor. 
	 * @param contributors a collection of {@link UriComponentsContributor} 
	 * or {@link HandlerMethodArgumentResolver}s. 
	 */ 
	public CompositeUriComponentsContributor(Collection<?> contributors) {
		this(contributors, null);
	} 
6
CodeRank
This code example shows how to use the following methods:
		return config;
	} 
 
	@Bean 
	public DefaultFormattingConversionService defaultConversionService() {
		return new DefaultFormattingConversionService();
	} 
 
	@Bean 
	public DomainClassConverter<?> domainClassConverter() { 
		return new DomainClassConverter<DefaultFormattingConversionService>(defaultConversionService());
	} 
 
	@Bean 
	public PersistentEntities persistentEntities() { 
		return new PersistentEntities(mappingContexts);
	} 
 
	@Bean 
	public UriToEntityConverter uriToEntityConverter() { 
6
CodeRank
This code example shows how to use the following methods:
 
	private FormattingConversionService conversionService;
 
	@Before 
	public void setup() { 
		this.conversionService = new DefaultFormattingConversionService();
		DataBinder dataBinder = new DataBinder(null);
		dataBinder.setConversionService(conversionService);
 
		this.redirectAttributes = new RedirectAttributesModelMap(dataBinder);
	} 
 
	@Test
	public void addAttributePrimitiveType() { 
		this.redirectAttributes.addAttribute("speed", 65);
		assertEquals("65", this.redirectAttributes.get("speed"));
	} 
 
	@Test
	public void addAttributeCustomType() { 
6
CodeRank
This code example shows how to use the following methods:
	 * Creates a new {@link DefaultRepositoryInvokerFactory} for the given {@link Repositories}. 
	 *  
	 * @param repositories must not be {@literal null}. 
	 */ 
	public DefaultRepositoryInvokerFactory(Repositories repositories) {
		this(repositories, new DefaultFormattingConversionService());
	} 
 
	/** 
	 * Creates a new {@link DefaultRepositoryInvokerFactory} for the given {@link Repositories} and 
	 * {@link ConversionService}. 
	 *  
	 * @param repositories must not be {@literal null}. 
	 * @param conversionService must not be {@literal null}. 
	 */ 
	public DefaultRepositoryInvokerFactory(Repositories repositories, ConversionService conversionService) {
 
		Assert.notNull(repositories, "Repositories must not be null!");
		Assert.notNull(conversionService, "ConversionService must not be null!");
 
5
CodeRank
This code example shows how to use the following methods:
 *  
 * @author Oliver Gierke 
 */ 
public class ConvertingPropertyAccessorUnitTests { 
 
	static final ConversionService CONVERSION_SERVICE = new DefaultFormattingConversionService();
 
	/** 
	 * @see DATACMNS-596 
	 */ 
	@Test(expected = IllegalArgumentException.class)
	public void rejectsNullPropertyAccessorDelegate() { 
		new ConvertingPropertyAccessor(null, CONVERSION_SERVICE);
	} 
 
	/** 
	 * @see DATACMNS-596 
	 */ 
	@Test(expected = IllegalArgumentException.class)
	public void rejectsNullConversionService() { 
5
CodeRank
This code example shows how to use the following methods:
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;
 
public class BooleanFilterTest { 
 
	private static final GenericConversionService genericConversionService = new DefaultFormattingConversionService();
 
	@Test
	public void testFalseFilter() { 
		BooleanFilter filter = new BooleanFilter("field", false, null, null);
		assertThat(filter.getValue()).isEqualTo(false);
		assertThat(filter.getField()).isEqualTo("field");
		assertThat(filter.getRawComparison()).isNull();
		assertThat(filter.getComparison()).isNull();
	} 
 
	@Test
	public void testTrueFilter() { 
		BooleanFilter filter = new BooleanFilter("xy", true, null, null);
		assertThat(filter.getValue()).isEqualTo(true);
5
CodeRank
This code example shows how to use the following methods:
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;
 
public class StringFilterTest { 
 
	private static final GenericConversionService genericConversionService = new DefaultFormattingConversionService();
 
	@Test
	public void testString() { 
		StringFilter filter = new StringFilter("field", "value", null, null);
		assertThat(filter.getValue()).isEqualTo("value");
		assertThat(filter.getField()).isEqualTo("field");
		assertThat(filter.getRawComparison()).isNull();
		assertThat(filter.getComparison()).isNull();
		assertThat(filter.getRawComparison()).isNull();
	} 
 
	@Test
	public void testStringFilter() { 
		Map<String, Object> json = new HashMap<String, Object>();
4
CodeRank
This code example shows how to use the following methods:
@Configuration 
public class MvcBeans { 
 
    @Bean 
    public ConversionService conversionService() { 
        DefaultFormattingConversionService bean = new DefaultFormattingConversionService(); 
        return bean; 
    } 
 
 
    @Bean 
    public ContentNegotiatingViewResolver contentNegotiatingViewResolver() { 
        ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver(); 
        viewResolver.setMediaTypes(mediaTypes()); 
        viewResolver.setViewResolvers(viewResolvers()); 
        viewResolver.setDefaultViews(defaultViews()); 
        return viewResolver; 
    } 
 
    private Map<String, String> mediaTypes() { 
4
CodeRank
This code example shows how to use the following methods:
import org.springframework.format.support.DefaultFormattingConversionService;
 
@RunWith(Parameterized.class) 
public class NumericFilterTest { 
 
	private static final GenericConversionService genericConversionService = new DefaultFormattingConversionService();
 
	@Parameters 
	public static Collection<Object[]> types() {
		return Arrays.asList(new Object[][] { { "numeric" }, { "int" }, { "float" },
				{ "number" } }); 
	} 
 
	@Parameter
	public String type;
 
	@Test
	public void testNumericFilterLT() { 
		Map<String, Object> json = new HashMap<String, Object>();
		json.put("field", "aField");
4
CodeRank