|
@@ -19,21 +19,19 @@ public class GenerateObjectUtil {
|
|
|
public static void setObjectProperty(Object obj, String propertyName, Object value) throws Exception {
|
|
|
// String setMethodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
|
|
|
Field field = obj.getClass().getDeclaredField(propertyName);
|
|
|
- field.setAccessible(true);
|
|
|
- if(value!=null&&field.getType()!=value.getClass()){
|
|
|
- value=null;
|
|
|
- }
|
|
|
- field.set(obj,value);
|
|
|
-
|
|
|
+ field.setAccessible(true);
|
|
|
+ if (value != null && field.getType() != value.getClass()) {
|
|
|
+ value = null;
|
|
|
+ }
|
|
|
+ field.set(obj, value);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @param obj
|
|
|
* @param propertyName
|
|
|
* @return
|
|
|
*/
|
|
|
- public static Object getPropertyValue(Object obj, String propertyName){
|
|
|
+ public static Object getPropertyValue(Object obj, String propertyName) {
|
|
|
try {
|
|
|
String getMethodName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
|
|
|
Method method = obj.getClass().getMethod(getMethodName);
|