Examples of StringTrimmerEditor


Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

    GenericBean<String> gb = new GenericBean<String>();
    ArrayList<String[]> list = new ArrayList<String[]>();
    list.add(new String[] {"str1", "str2"});
    gb.setListOfArrays(list);
    BeanWrapper bw = new BeanWrapperImpl(gb);
    bw.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
    assertEquals("str3", bw.getPropertyValue("listOfArrays[0][1]"));
    assertEquals("str3", gb.getListOfArrays().get(0)[1]);
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

    mcfb.afterPropertiesSet();
    mcfb.getObjectType();

    // fail on improper argument types at afterPropertiesSet
    mcfb = new MethodInvokingFactoryBean();
    mcfb.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    mcfb.setTargetClass(TestClass1.class);
    mcfb.setTargetMethod("supertypes");
    mcfb.setArguments(new Object[] {"1", new Object()});
    try {
      mcfb.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

  @Test
  public void missingRequestParamEmptyValueConvertedToNull() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "stringNotAnnot")).willReturn(binder);

    this.request.addParameter("stringNotAnnot", "");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

  @Test
  public void missingRequestParamEmptyValueNotRequired() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "name")).willReturn(binder);

    this.request.addParameter("name", "");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

  public void testWithSingleValueAndEditor() throws Exception {
    this.bean.setName("Rob Harrop");
    this.tag.setPath("name");
    this.tag.setValue("   Rob Harrop");
    BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(this.bean, COMMAND_NAME);
    bindingResult.getPropertyEditorRegistry().registerCustomEditor(String.class, new StringTrimmerEditor(false));
    getPageContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, bindingResult);

    int result = this.tag.doStartTag();
    assertEquals(Tag.SKIP_BODY, result);
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

    GenericBean<String> gb = new GenericBean<String>();
    ArrayList<String[]> list = new ArrayList<String[]>();
    list.add(new String[] {"str1", "str2"});
    gb.setListOfArrays(list);
    BeanWrapper bw = new BeanWrapperImpl(gb);
    bw.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
    assertEquals("str3", bw.getPropertyValue("listOfArrays[0][1]"));
    assertEquals("str3", gb.getListOfArrays().get(0)[1]);
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

     *
     * @param binder Binder object to be injected
     */
    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

     *
     * @param binder Binder object to be injected
     */
    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

     *
     * @param binder Binder object to be injected
     */
    @InitBinder({"dto", "newUser"})
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
        binder.registerCustomEditor(String.class, "userDto.username", new StringTrimmerEditor(false));
        binder.registerCustomEditor(String.class, "userDto.password", new DefaultStringEditor(false));
        binder.registerCustomEditor(String.class, "passwordConfirm", new DefaultStringEditor(false));
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.StringTrimmerEditor

  public void initBinder(WebDataBinder binder, WebRequest request) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    binder.registerCustomEditor(PetType.class, new PetTypeEditor(this.clinic));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.