001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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(Object bean, String param, byte defaultValue) {
069                    return getBeanProperties().getByte(bean, param, defaultValue);
070            }
071    
072            public static byte getByteSilent(Object bean, String param) {
073                    return getBeanProperties().getByteSilent(bean, param);
074            }
075    
076            public static byte getByteSilent(
077                    Object bean, String param, byte defaultValue) {
078    
079                    return getBeanProperties().getByteSilent(bean, param, defaultValue);
080            }
081    
082            public static double getDouble(Object bean, String param) {
083                    return getBeanProperties().getDouble(bean, param);
084            }
085    
086            public static double getDouble(
087                    Object bean, String param, double defaultValue) {
088    
089                    return getBeanProperties().getDouble(bean, param, defaultValue);
090            }
091    
092            public static double getDoubleSilent(Object bean, String param) {
093                    return getBeanProperties().getDoubleSilent(bean, param);
094            }
095    
096            public static double getDoubleSilent(
097                    Object bean, String param, double defaultValue) {
098    
099                    return getBeanProperties().getDoubleSilent(bean, param, defaultValue);
100            }
101    
102            public static float getFloat(Object bean, String param) {
103                    return getBeanProperties().getFloat(bean, param);
104            }
105    
106            public static float getFloat(
107                    Object bean, String param, float defaultValue) {
108    
109                    return getBeanProperties().getFloat(bean, param, defaultValue);
110            }
111    
112            public static float getFloatSilent(Object bean, String param) {
113                    return getBeanProperties().getFloatSilent(bean, param);
114            }
115    
116            public static float getFloatSilent(
117                    Object bean, String param, float defaultValue) {
118    
119                    return getBeanProperties().getFloatSilent(bean, param, defaultValue);
120            }
121    
122            public static int getInteger(Object bean, String param) {
123                    return getBeanProperties().getInteger(bean, param);
124            }
125    
126            public static int getInteger(Object bean, String param, int defaultValue) {
127                    return getBeanProperties().getInteger(bean, param, defaultValue);
128            }
129    
130            public static int getIntegerSilent(Object bean, String param) {
131                    return getBeanProperties().getIntegerSilent(bean, param);
132            }
133    
134            public static int getIntegerSilent(
135                    Object bean, String param, int defaultValue) {
136    
137                    return getBeanProperties().getIntegerSilent(bean, param, defaultValue);
138            }
139    
140            public static long getLong(Object bean, String param) {
141                    return getBeanProperties().getLong(bean, param);
142            }
143    
144            public static long getLong(Object bean, String param, long defaultValue) {
145                    return getBeanProperties().getLong(bean, param, defaultValue);
146            }
147    
148            public static long getLongSilent(Object bean, String param) {
149                    return getBeanProperties().getLongSilent(bean, param);
150            }
151    
152            public static long getLongSilent(
153                    Object bean, String param, long defaultValue) {
154    
155                    return getBeanProperties().getLongSilent(bean, param, defaultValue);
156            }
157    
158            public static Object getObject(Object bean, String param) {
159                    return getBeanProperties().getObject(bean, param);
160            }
161    
162            public static Object getObject(
163                    Object bean, String param, Object defaultValue) {
164    
165                    return getBeanProperties().getObject(bean, param, defaultValue);
166            }
167    
168            public static Object getObjectSilent(Object bean, String param) {
169                    return getBeanProperties().getObjectSilent(bean, param);
170            }
171    
172            public static Object getObjectSilent(
173                    Object bean, String param, Object defaultValue) {
174    
175                    return getBeanProperties().getObjectSilent(bean, param, defaultValue);
176            }
177    
178            public static Class<?> getObjectType(Object bean, String param) {
179                    return getBeanProperties().getObjectType(bean, param);
180            }
181    
182            public static Class<?> getObjectType(
183                    Object bean, String param, Class<?> defaultValue) {
184    
185                    return getBeanProperties().getObjectType(bean, param, defaultValue);
186            }
187    
188            public static Class<?> getObjectTypeSilent(Object bean, String param) {
189                    return getBeanProperties().getObjectType(bean, param);
190            }
191    
192            public static Class<?> getObjectTypeSilent(
193                    Object bean, String param, Class<?> defaultValue) {
194    
195                    return getBeanProperties().getObjectType(bean, param, defaultValue);
196            }
197    
198            public static short getShort(Object bean, String param) {
199                    return getBeanProperties().getShort(bean, param);
200            }
201    
202            public static short getShort(
203                    Object bean, String param, short defaultValue) {
204    
205                    return getBeanProperties().getShort(bean, param, defaultValue);
206            }
207    
208            public static short getShortSilent(Object bean, String param) {
209                    return getBeanProperties().getShortSilent(bean, param);
210            }
211    
212            public static short getShortSilent(
213                    Object bean, String param, short defaultValue) {
214    
215                    return getBeanProperties().getShortSilent(bean, param, defaultValue);
216            }
217    
218            public static String getString(Object bean, String param) {
219                    return getBeanProperties().getString(bean, param);
220            }
221    
222            public static String getString(
223                    Object bean, String param, String defaultValue) {
224    
225                    return getBeanProperties().getString(bean, param, defaultValue);
226            }
227    
228            public static String getStringSilent(Object bean, String param) {
229                    return getBeanProperties().getStringSilent(bean, param);
230            }
231    
232            public static String getStringSilent(
233                    Object bean, String param, String defaultValue) {
234    
235                    return getBeanProperties().getStringSilent(bean, param, defaultValue);
236            }
237    
238            public static void setProperties(Object bean, HttpServletRequest request) {
239                    getBeanProperties().setProperties(bean, request);
240            }
241    
242            public static void setProperty(Object bean, String param, Object value) {
243                    getBeanProperties().setProperty(bean, param, value);
244            }
245    
246            public void setBeanProperties(BeanProperties beanProperties) {
247                    _beanProperties = beanProperties;
248            }
249    
250            private static BeanProperties _beanProperties;
251    
252    }