01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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: }
|