1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.beanutils;
18
19 /***
20 * {@link ConvertUtilsBean} implementation that delegates <code>convert()</code>
21 * methods to the new {@link ConvertUtilsBean#convert(Object, Class)} method.
22 *
23 * <p>
24 * To configure this implementation for the current context ClassLoader invoke
25 * <code>BeanUtilsBean.setInstance(new BeanUtilsBean2());</code>
26 * </p>
27 *
28 * @see BeanUtilsBean2
29 * @version $Revision: 552381 $ $Date: 2007-07-02 03:00:17 +0100 (Mon, 02 Jul 2007) $
30 * @since 1.8.0
31 */
32 public class ConvertUtilsBean2 extends ConvertUtilsBean {
33
34 /***
35 * Delegates to the new {@link ConvertUtilsBean#convert(Object, Class)}
36 * method.
37 *
38 * @param value Value to be converted (may be null)
39 * @return The converted String value
40 *
41 * @see ConvertUtilsBean#convert(String[], Class)
42 */
43 public String convert(Object value) {
44 return (String)convert(value, String.class);
45 }
46
47 /***
48 * Delegates to the new {@link ConvertUtilsBean#convert(Object, Class)}
49 * method.
50 *
51 * @param value Value to be converted (may be null)
52 * @param clazz Java class to be converted to
53 * @return The converted value
54 *
55 * @see ConvertUtilsBean#convert(String[], Class)
56 */
57 public Object convert(String value, Class clazz) {
58 return convert((Object)value, clazz);
59 }
60
61 /***
62 * Delegates to the new {@link ConvertUtilsBean#convert(Object, Class)}
63 * method.
64 *
65 * @param value Array of values to be converted
66 * @param clazz Java array or element class to be converted to
67 * @return The converted value
68 *
69 * @see ConvertUtilsBean#convert(String[], Class)
70 */
71 public Object convert(String[] value, Class clazz) {
72 return convert((Object)value, clazz);
73 }
74
75 }