| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.beans.IntrospectionException; |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.*; |
| | | import java.math.BigDecimal; |
| | |
| | | * @param beanClass Bean的类 |
| | | * @return 从列表里获取第一个对象 |
| | | */ |
| | | public static <T> T getFirstObjectFromJson(String jsonString,Class<T> beanClass){ |
| | | public static <T> T getFirstObjectFromJsonArray(String jsonString,Class<T> beanClass){ |
| | | if(!isNull(jsonString)) { |
| | | return JSONObject.parseArray(jsonString, beanClass).get(0); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从json字符串中获取第一个对象 |
| | | * @param jsonString json的字符串 |
| | | * @param beanClass Bean的类 |
| | | * @return 从列表里获取第一个对象 |
| | | */ |
| | | public static <T> List<T> getObjectListFromJsonArray(String jsonString,Class<T> beanClass){ |
| | | if(!isNull(jsonString)) { |
| | | return JSONObject.parseArray(jsonString, beanClass); |
| | | } else { |
| | | return null; |
| | | } |
| | |
| | | }else{ |
| | | fieldValue = getStringValueFromObject(value); |
| | | } |
| | | setValueForFieldFromCbo(fieldAttrMap.get(field.getName().toLowerCase()), obj, fieldValue); |
| | | String fieldName = fieldAttrMap.get(field.getName().toLowerCase()); |
| | | if(StringUtils.isNotBlank(fieldName)){ |
| | | setValueForFieldFromCbo(fieldName, obj, fieldValue); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | * @return base异常对象 |
| | | */ |
| | | public static VciBaseException getVciBaseException(PLException e){ |
| | | return new VciBaseException(e.code, new java.lang.String[]{e.getMessage()}); |
| | | return new VciBaseException(e.code, new String[]{e.getMessage()}); |
| | | } |
| | | |
| | | /** |