Spring Framework DefaultDataBinderFactory - 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 DefaultDataBinderFactory class.

This code example shows how to use the following methods:
 
	@Test 
	public void resolveOptional() throws Exception { 
		ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer(); 
		initializer.setConversionService(new DefaultConversionService()); 
		WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer); 
 
		Object result = resolver.resolveArgument(paramOptional, null, webRequest, binderFactory); 
		assertEquals(Optional.class, result.getClass()); 
		assertEquals(Optional.empty(), result); 
 
		this.request.addParameter("name", "123"); 
		result = resolver.resolveArgument(paramOptional, null, webRequest, binderFactory); 
		assertEquals(Optional.class, result.getClass()); 
		assertEquals(123, ((Optional) result).get()); 
	} 
 
 
	public void params(@RequestParam(value = "name", defaultValue = "bar") String param1, 
			@RequestParam("name") String[] param2, 
6
CodeRank
This code example shows how to use the following methods:
 
    req = new MockHttpServletRequest(); 
    req.setContent("[1,2,3]".getBytes()); 
    req.setContentType("application/json"); 
    resp = new MockHttpServletResponse(); 
    Object o = handler.resolveArgument(new MethodParameter(SpringIntegrationTest.class.getMethod("set", int[].class), 0), new ModelAndViewContainer(), new ServletWebRequest(req, resp), new DefaultDataBinderFactory(null)); 
    assertArrayEquals(new int[]{1, 2, 3}, (int[]) o); 
  } 
 
  public void set(@RequestBody int[] data) { 
 
  } 
 
  public 
  @ResponseBody 
  Primitives get() { 
    return new Primitives(923456789, new Integer(861289603), 54566544.0998891, null, null, 
      false, true); 
  } 
} 
4
CodeRank