1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.bean;
16  
17  /**
18   * <a href="BeanPropertiesUtil.java.html"><b><i>View Source</i></b></a>
19   *
20   * @author Brian Wing Shun Chan
21   */
22  public class BeanPropertiesUtil {
23  
24      public static void copyProperties(Object source, Object target) {
25          getBeanProperties().copyProperties(source, target);
26      }
27  
28      public static void copyProperties(
29          Object source, Object target, Class<?> editable) {
30  
31          getBeanProperties().copyProperties(source, target, editable);
32      }
33  
34      public static void copyProperties(
35          Object source, Object target, String[] ignoreProperties) {
36  
37          getBeanProperties().copyProperties(source, target, ignoreProperties);
38      }
39  
40      public static BeanProperties getBeanProperties() {
41          return _beanProperties;
42      }
43  
44      public static boolean getBoolean(Object bean, String param) {
45          return getBeanProperties().getBoolean(bean, param);
46      }
47  
48      public static boolean getBoolean(
49          Object bean, String param, boolean defaultValue) {
50  
51          return getBeanProperties().getBoolean(bean, param, defaultValue);
52      }
53  
54      public static double getDouble(Object bean, String param) {
55          return getBeanProperties().getDouble(bean, param);
56      }
57  
58      public static double getDouble(
59          Object bean, String param, double defaultValue) {
60  
61          return getBeanProperties().getDouble(bean, param, defaultValue);
62      }
63  
64      public static int getInteger(Object bean, String param) {
65          return getBeanProperties().getInteger(bean, param);
66      }
67  
68      public static int getInteger(
69          Object bean, String param, int defaultValue) {
70  
71          return getBeanProperties().getInteger(bean, param, defaultValue);
72      }
73  
74      public static long getLong(Object bean, String param) {
75          return getBeanProperties().getLong(bean, param);
76      }
77  
78      public static long getLong(
79          Object bean, String param, long defaultValue) {
80  
81          return getBeanProperties().getLong(bean, param, defaultValue);
82      }
83  
84      public static Object getObject(Object bean, String param) {
85          return getBeanProperties().getObject(bean, param);
86      }
87  
88      public static Object getObject(
89          Object bean, String param, Object defaultValue) {
90  
91          return getBeanProperties().getObject(bean, param, defaultValue);
92      }
93  
94      public static String getString(Object bean, String param) {
95          return getBeanProperties().getString(bean, param);
96      }
97  
98      public static String getString(
99          Object bean, String param, String defaultValue) {
100 
101         return getBeanProperties().getString(bean, param, defaultValue);
102     }
103 
104     public void setBeanProperties(BeanProperties beanProperties) {
105         _beanProperties = beanProperties;
106     }
107 
108     private static BeanProperties _beanProperties;
109 
110 }