img
.
Adding 11 bytes
Setting class: java.lang.String
Setting Boolean: true
Setting string list with size: 2
String member: String member 1
String member: String member 2
Setting date: Thu Dec 29 00:00:00 CST 2011
Setting float value: 123.45678
Setting file: test.txt
Setting stream: java.io.BufferedInputStream@6490832e
Setting locale: English (US)
Setting pattern: a*b
Loaded 2 properties
Setting trim string: String need trimming
Setting URL: http://www.springframework.org
As you can see, Spring has, using the built-in PropertyEditors, converted the String representations
of the various properties to the correct types. Table 5-1 summarizes the built-in PropertyEditors
available in Spring.
Table 5-1. Spring PropertyEditors
PropertyEditor
Description
This PropertyEditor converts a String value into an array of bytes.
ByteArrayPropertyEditor
The ClassEditor converts from a fully qualified class name into a Class
ClassEditor
instance. When using this PropertyEditor, be careful not to include any
extraneous spaces on either side of the class name when using
GenericXmlApplicationContext, because this results in a
ClassNotFoundException.
Convert a string into Java Boolean type.
CustomBooleanEditor
Converting a source collection (e.g., represent by the util namespace in
CustomCollectionEditor
Spring) into the target Collection type.
Convert a string representation of date into a java.util.Date value. You
CustomDateEditor
need to register the CustomDateEditor in Spring's ApplicationContext with
the desired date format.
Convert a string into the target number value, which can be Integer, Long,
CustomNumberEditor
Float, and Double.
The FileEditor converts a String file path into a File instance. Spring does
FileEditor
not check to see whether the file exists.
Convert a string representation of a resource (e.g., file resource using
InputStreamEditor
file:D:/temp/test.txt or classpath:test.txt) into an input stream
property.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home