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

This code example shows how to use the following methods:setAsText, getValue
This code example shows how to use the following methods:setAsText, getValue
		DefaultPropertyEditorRegistrar mapper = new DefaultPropertyEditorRegistrar();
		BeanWithIntArray result = new BeanWithIntArray();
		mapper.setCustomEditors(Collections.singletonMap(int[].class, new IntArrayPropertyEditor()));
		BeanWrapperImpl wrapper = new BeanWrapperImpl(result);
		mapper.registerCustomEditors(wrapper);
		PropertiesEditor editor = new PropertiesEditor();
		editor.setAsText("numbers=1,2,3, 4");
		Properties props = (Properties) editor.getValue();
		wrapper.setPropertyValues(props);
		assertEquals(4, result.numbers[3]);
	} 
 
	@Test(expected = IllegalArgumentException.class)
	public void testSetCustomEditorsWithInvalidTypeName() throws Exception {
 
		DefaultPropertyEditorRegistrar mapper = new DefaultPropertyEditorRegistrar();
		mapper.setCustomEditors(Collections.singletonMap("FOO", new CustomNumberEditor(Long.class, true)));
	} 
 
	@Test
7
CodeRank
This code example shows how to use the following methods:setAsText, getValue
			// empty environment 
			setValue(new JndiTemplate());
		} 
		else { 
			// we have a non-empty properties string 
			this.propertiesEditor.setAsText(text);
			Properties props = (Properties) this.propertiesEditor.getValue();
			setValue(new JndiTemplate(props));
		} 
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:setAsText, getValue
 
        if ((s == null) || "".equals(s)) {
            // Leave value in property editor null 
        } else { 
            // Use properties editor to tokenize the string 
            PropertiesEditor propertiesEditor = new PropertiesEditor();
            propertiesEditor.setAsText(s);
 
            Properties props = (Properties) propertiesEditor.getValue();
            addUsersFromProperties(userMap, props);
        } 
 
        setValue(userMap);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:setAsText, getValue
  @Override 
  public void setAsText( final String s ) throws IllegalArgumentException {
    UserRoleListEnhancedUserMap userRoleListEnhanceduserMap = new UserRoleListEnhancedUserMap();
 
    // Use properties editor to tokenize the string 
    PropertiesEditor propertiesEditor = new PropertiesEditor();
    propertiesEditor.setAsText( s );
 
    Properties props = (Properties) propertiesEditor.getValue();
    UserRoleListEnhancedUserMapEditor.addUsersFromProperties( userRoleListEnhanceduserMap, props );
 
    setValue( userRoleListEnhanceduserMap );
  } 
 
  public static UserRoleListEnhancedUserMap addUsersFromProperties( final UserRoleListEnhancedUserMap userMap,
      final Properties props ) {
    // Now we have properties, process each one individually 
    UserAttributeEditor configAttribEd = new UserAttributeEditor();
 
    for ( Object element : props.keySet() ) {
6
CodeRank
See Code Examples for Spring Framework PropertiesEditor Methods: