code: public static <T> T toType(Object data, Class<T> type) {
          try {
              if (Reflection.instanceOf(data, type)) {
                  return Reflection.cast(data, type);
              }
              if (Collection.class.isAssignableFrom(type)) {
                  return toCollectionType(data, type);
              }
              if (type.isArray()) {
                  return toArray(data, type);
              }
              return toNonCollectionType(data, type);
          } catch (Throwable e) {
              throw castFailedException(data, type, e);
          }
      }
docs: <p>
  This is a flexible tolerable type casting method with the help of serializing tools (fastjson currently).
  </p>
  Supports:<br>
  map to jsonObject to bean <br>
  collection ---- fetch the first element and cast it to map/json/bean<br>
  collection --set-- HashSet<br>
  collection --list-- ArrayList<br>
  collection --queue-- LinkedList<br>