Package org.springframework.beans.propertyeditors

Examples of org.springframework.beans.propertyeditors.PropertiesEditor


            setValue(new MapBasedMethodSecurityMetadataSource());
            return;
        }

        // Use properties editor to tokenize the string
        PropertiesEditor propertiesEditor = new PropertiesEditor();
        propertiesEditor.setAsText(s);

        Properties props = (Properties) propertiesEditor.getValue();

        // Now we have properties, process each one individually
        Map<String, List<ConfigAttribute>> mappings = new LinkedHashMap<String, List<ConfigAttribute>>();

        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
View Full Code Here


        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);
    }
View Full Code Here

    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(InputSource.class, new InputSourceEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
    this.defaultEditors.put(URL.class, new URLEditor());
    this.defaultEditors.put(UUID.class, new UUIDEditor());
View Full Code Here

  @Override
  public void setAsText(String text) throws IllegalArgumentException {
    MethodMapTransactionAttributeSource source = new MethodMapTransactionAttributeSource();
    if (StringUtils.hasLength(text)) {
      // Use properties editor to tokenize the hold string.
      PropertiesEditor propertiesEditor = new PropertiesEditor();
      propertiesEditor.setAsText(text);
      Properties props = (Properties) propertiesEditor.getValue();

      // Now we have properties, process each one individually.
      TransactionAttributeEditor tae = new TransactionAttributeEditor();
      Enumeration<?> propNames = props.propertyNames();
      while (propNames.hasMoreElements()) {
View Full Code Here

    this.defaultEditors.put(Currency.class, new CurrencyEditor());
    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
    this.defaultEditors.put(URL.class, new URLEditor());
    this.defaultEditors.put(UUID.class, new UUIDEditor());
View Full Code Here

  @Override
  public void setAsText(String text) throws IllegalArgumentException {
    MethodMapTransactionAttributeSource source = new MethodMapTransactionAttributeSource();
    if (StringUtils.hasLength(text)) {
      // Use properties editor to tokenize the hold string.
      PropertiesEditor propertiesEditor = new PropertiesEditor();
      propertiesEditor.setAsText(text);
      Properties props = (Properties) propertiesEditor.getValue();

      // Now we have properties, process each one individually.
      TransactionAttributeEditor tae = new TransactionAttributeEditor();
      Enumeration propNames = props.propertyNames();
      while (propNames.hasMoreElements()) {
View Full Code Here

    this.defaultEditors.put(File.class, new FileEditor());
    this.defaultEditors.put(InputStream.class, new InputStreamEditor());
    this.defaultEditors.put(InputSource.class, new InputSourceEditor());
    this.defaultEditors.put(Locale.class, new LocaleEditor());
    this.defaultEditors.put(Pattern.class, new PatternEditor());
    this.defaultEditors.put(Properties.class, new PropertiesEditor());
    this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
    this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
    this.defaultEditors.put(URI.class, new URIEditor());
    this.defaultEditors.put(URL.class, new URLEditor());
    this.defaultEditors.put(UUID.class, new UUIDEditor());
View Full Code Here

        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);
    }
View Full Code Here

  @Test
  public void testPlainBeanWrapper() throws Exception {
    TestObject result = new TestObject();
    BeanWrapperImpl wrapper = new BeanWrapperImpl(result);
    PropertiesEditor editor = new PropertiesEditor();
    editor.setAsText("varString=This is some dummy string\nvarBoolean=true\nvarChar=C");
    Properties props = (Properties) editor.getValue();
    wrapper.setPropertyValues(props);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
  }
View Full Code Here

    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]);
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.propertyeditors.PropertiesEditor

Copyright © 2018 www.massapicom. 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.