001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.bean;
016    
017    import javax.servlet.http.HttpServletRequest;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class BeanPropertiesUtil {
023    
024            public static void copyProperties(Object source, Object target) {
025                    getBeanProperties().copyProperties(source, target);
026            }
027    
028            public static void copyProperties(
029                    Object source, Object target, Class<?> editable) {
030    
031                    getBeanProperties().copyProperties(source, target, editable);
032            }
033    
034            public static void copyProperties(
035                    Object source, Object target, String[] ignoreProperties) {
036    
037                    getBeanProperties().copyProperties(source, target, ignoreProperties);
038            }
039    
040            public static BeanProperties getBeanProperties() {
041                    return _beanProperties;
042            }
043    
044            public static boolean getBoolean(Object bean, String param) {
045                    return getBeanProperties().getBoolean(bean, param);
046            }
047    
048            public static boolean getBoolean(
049                    Object bean, String param, boolean defaultValue) {
050    
051                    return getBeanProperties().getBoolean(bean, param, defaultValue);
052            }
053    
054            public static boolean getBooleanSilent(Object bean, String param) {
055                    return getBeanProperties().getBooleanSilent(bean, param);
056            }
057    
058            public static boolean getBooleanSilent(
059                    Object bean, String param, boolean defaultValue) {
060    
061                    return getBeanProperties().getBooleanSilent(bean, param, defaultValue);
062            }
063    
064            public static byte getByte(Object bean, String param) {
065                    return getBeanProperties().getByte(bean, param);
066            }
067    
068            public static byte getByte(
069                    Object bean, String param, byte defaultValue) {
070    
071                    return getBeanProperties().getByte(bean, param, defaultValue);
072            }
073    
074            public static byte getByteSilent(Object bean, String param) {
075                    return getBeanProperties().getByteSilent(bean, param);
076            }
077    
078            public static byte getByteSilent(
079                    Object bean, String param, byte defaultValue) {
080    
081                    return getBeanProperties().getByteSilent(bean, param, defaultValue);
082            }
083    
084            public static double getDouble(Object bean, String param) {
085                    return getBeanProperties().getDouble(bean, param);
086            }
087    
088            public static double getDouble(
089                    Object bean, String param, double defaultValue) {
090    
091                    return getBeanProperties().getDouble(bean, param, defaultValue);
092            }
093    
094            public static double getDoubleSilent(Object bean, String param) {
095                    return getBeanProperties().getDoubleSilent(bean, param);
096            }
097    
098            public static double getDoubleSilent(
099                    Object bean, String param, double defaultValue) {
100    
101                    return getBeanProperties().getDoubleSilent(bean, param, defaultValue);
102            }
103    
104            public static float getFloat(Object bean, String param) {
105                    return getBeanProperties().getFloat(bean, param);
106            }
107    
108            public static float getFloat(
109                    Object bean, String param, float defaultValue) {
110    
111                    return getBeanProperties().getFloat(bean, param, defaultValue);
112            }
113    
114            public static float getFloatSilent(Object bean, String param) {
115                    return getBeanProperties().getFloatSilent(bean, param);
116            }
117    
118            public static float getFloatSilent(
119                    Object bean, String param, float defaultValue) {
120    
121                    return getBeanProperties().getFloatSilent(bean, param, defaultValue);
122            }
123    
124            public static int getInteger(Object bean, String param) {
125                    return getBeanProperties().getInteger(bean, param);
126            }
127    
128            public static int getInteger(
129                    Object bean, String param, int defaultValue) {
130    
131                    return getBeanProperties().getInteger(bean, param, defaultValue);
132            }
133    
134            public static int getIntegerSilent(Object bean, String param) {
135                    return getBeanProperties().getIntegerSilent(bean, param);
136            }
137    
138            public static int getIntegerSilent(
139                    Object bean, String param, int defaultValue) {
140    
141                    return getBeanProperties().getIntegerSilent(bean, param, defaultValue);
142            }
143    
144            public static long getLong(Object bean, String param) {
145                    return getBeanProperties().getLong(bean, param);
146            }
147    
148            public static long getLong(
149                    Object bean, String param, long defaultValue) {
150    
151                    return getBeanProperties().getLong(bean, param, defaultValue);
152            }
153    
154            public static long getLongSilent(Object bean, String param) {
155                    return getBeanProperties().getLongSilent(bean, param);
156            }
157    
158            public static long getLongSilent(
159                    Object bean, String param, long defaultValue) {
160    
161                    return getBeanProperties().getLongSilent(bean, param, defaultValue);
162            }
163    
164            public static Object getObject(Object bean, String param) {
165                    return getBeanProperties().getObject(bean, param);
166            }
167    
168            public static Object getObject(
169                    Object bean, String param, Object defaultValue) {
170    
171                    return getBeanProperties().getObject(bean, param, defaultValue);
172            }
173    
174            public static Object getObjectSilent(Object bean, String param) {
175                    return getBeanProperties().getObjectSilent(bean, param);
176            }
177    
178            public static Object getObjectSilent(
179                    Object bean, String param, Object defaultValue) {
180    
181                    return getBeanProperties().getObjectSilent(bean, param, defaultValue);
182            }
183    
184            public static short getShort(Object bean, String param) {
185                    return getBeanProperties().getShort(bean, param);
186            }
187    
188            public static short getShort(
189                    Object bean, String param, short defaultValue) {
190    
191                    return getBeanProperties().getShort(bean, param, defaultValue);
192            }
193    
194            public static short getShortSilent(Object bean, String param) {
195                    return getBeanProperties().getShortSilent(bean, param);
196            }
197    
198            public static short getShortSilent(
199                    Object bean, String param, short defaultValue) {
200    
201                    return getBeanProperties().getShortSilent(bean, param, defaultValue);
202            }
203    
204            public static String getString(Object bean, String param) {
205                    return getBeanProperties().getString(bean, param);
206            }
207    
208            public static String getString(
209                    Object bean, String param, String defaultValue) {
210    
211                    return getBeanProperties().getString(bean, param, defaultValue);
212            }
213    
214            public static String getStringSilent(Object bean, String param) {
215                    return getBeanProperties().getStringSilent(bean, param);
216            }
217    
218            public static String getStringSilent(
219                    Object bean, String param, String defaultValue) {
220    
221                    return getBeanProperties().getStringSilent(bean, param, defaultValue);
222            }
223    
224            public static void setProperties(Object bean, HttpServletRequest request) {
225                    getBeanProperties().setProperties(bean, request);
226            }
227    
228            public static void setProperty(Object bean, String param, Object value) {
229                    getBeanProperties().setProperty(bean, param, value);
230            }
231    
232            public void setBeanProperties(BeanProperties beanProperties) {
233                    _beanProperties = beanProperties;
234            }
235    
236            private static BeanProperties _beanProperties;
237    
238    }