Exemple #1
0
 /**
  * getJsonable
  *
  * @return
  * @author 唐延波
  * @date 2015年7月6日
  */
 private static Jsonable getJsonable() {
   Jsonable jsonable = null;
   if (DEFAULT_JSON.equals(FAST_JSON)) {
     jsonable = new FastJson();
   } else if (DEFAULT_JSON.equals(JSON_LIB)) {
     jsonable = new JsonLib();
   }
   jsonable.setDatePattern(DEFFAULT_DATE_FORMAT);
   return jsonable;
 }
Exemple #2
0
 /**
  * 将java bean转化为JSONObject
  *
  * @param bean
  * @param excludes
  * @return
  * @author 唐延波
  * @date 2015年7月6日
  */
 public static JSONObject toJSON(Object bean, String... excludes) {
   Jsonable jsonable = getJsonable();
   jsonable.setExcludes(excludes);
   return jsonable.toJSON(bean);
 }