反序列化复杂Collection如List<Bean>, contructCollectionType()或contructMapType()构造类型, 然后调用本函数.

@see #createCollectionType(Class, Class...)
161592
public <T> T fromJson(@Nullable String jsonString, JavaType javaType) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}

		try {
			return (T) mapper.readValue(jsonString, javaType);
		} catch (IOException e) {
			logger.warn("parse json string error:" + jsonString, e);
			return null;
		}
	}
192148
@SuppressWarnings("unchecked")
   public static <T, C extends Collection<T>> C convert(Object object, Class<?> collectionClass, Class<T> componentClass) {
      if (collectionClass == null || !Collection.class.isAssignableFrom(collectionClass)) {
         log.fine("{0} does not extend collection.", collectionClass);
         return null;
      }
      return Cast.as(CollectionConverter.COLLECTION(Cast.<Class<C>>as(collectionClass), componentClass).apply(object));
   }
749621
private void addCollectionProviderFixtureType(Class<?> clazz, List<FixtureType> listFixtureType, Set<Method> methods) {

        for (Method method : methods) {
            if (Collection.class.isAssignableFrom(method.getReturnType())) {
                FixtureType fixtureType = new FixtureType();
                if (method.isAnnotationPresent(FixtureCollection.class)) {
                    FixtureCollection annotation = method.getAnnotation(FixtureCollection.class);
                    if (annotation.deprecated()) {
                        fixtureType.setDeprecated(annotation.deprecated());
                    } else {
                        fixtureType.setBestpractice(annotation.bestPractice());
                    }
                }

                Type genericReturnType = method.getGenericReturnType();
                Class<?> typeClass;
                if (ParameterizedType.class.isAssignableFrom(genericReturnType.getClass())) {
                    ParameterizedType parameterizedReturnType = (ParameterizedType) genericReturnType;
                    LOGGER.debug("Checking the Collection Generic type: {}", parameterizedReturnType);
                    typeClass = (Class<?>) parameterizedReturnType.getActualTypeArguments()[0];
                } else {
                    // We take the Object class
                    typeClass = Object.class;
                }

                fixtureType.setClazz(returnTypeToString(clazz) + "/" + method.getName());
                List<MemberType> listMembreType = fixtureType.getMember();

                if (Modifier.isAbstract(clazz.getModifiers())) {
                    fixtureType.setCategory(CAT_FIXTURES_ABSTRAITES);
                } else {
                    @SuppressWarnings("unchecked")
                    Set<Field> allFields = getAllFields(typeClass,
                            and(or(withModifier(Modifier.PUBLIC), withModifier(Modifier.PRIVATE)),
                                    not(withModifier(Modifier.STATIC))));

                    for (Field field : allFields) {
                        MemberType membreType = new MemberType();
                        membreType.setName(field.getName());
                        membreType.setType(TypeMemberEnum.QUERY);
                        membreType.setReturntype(returnTypeToString(field.getType().getSimpleName()));
                        listMembreType.add(membreType);
                    }
                }

                listFixtureType.add(fixtureType);
            } else {
                LOGGER.warn("A method matching the CollectionIterpreter is not returning a Collection: {}", method.toString());
            }
        }

    }
86755
public <T extends Collection<V>, V> T readAsCollection(String content,
                                                           Class<? extends Collection> collectionType,
                                                           Class<V> elementsType) {
        try {
            CollectionLikeType type = MAPPER.getTypeFactory()
                .constructCollectionLikeType(collectionType, elementsType);
            return MAPPER.readValue(content, type);
        } catch (Exception e) {
            log.error("json解析失败，失败原因：", e);
            return null;
        }
    }
115431
public static boolean isCollectionType(final Type type) {
        return isParameterizedType(type) && isCollectionType((Class<?>) ((ParameterizedType) type).getRawType());
    }
164464
@SuppressWarnings({"rawtypes", "unchecked"})
    public static Collection convertListToCollection(final List list, final Class<Collection> toClass,
            final BeanFactory<Class<?>, Object> beanFactory) {

        if(list.getClass().equals(toClass)) {
            return list;
        }

        if(toClass.isInterface()) {
            if(List.class.isAssignableFrom(toClass)) {
                // 変換先がListの実態の場合はそのまま。
                return list;

            } else if(Set.class.isAssignableFrom(toClass)) {

                Collection value = (Collection) beanFactory.create(LinkedHashSet.class);
                value.addAll(list);
                return value;

            } else if(Queue.class.isAssignableFrom(toClass)) {

                Collection value = (Collection) beanFactory.create(LinkedList.class);
                value.addAll(list);
                return value;

            } else if(Collection.class.isAssignableFrom(toClass)) {
                Collection value = (Collection) beanFactory.create(ArrayList.class);
                value.addAll(list);
                return value;

            } else {
                throw new IllegalArgumentException("not support class type:" + toClass.getName());
            }

        }

        Collection value = (Collection) beanFactory.create(toClass);
        value.addAll(list);

        return value;

    }
1226636
private static String getCollectionInnerType(Class<?> type) {
        CQL3Type.Native nativeType = MAP_JAVA_TYPE_TO_CQL_TYPE.get(type);
        return nativeType.name().toLowerCase();
    }
343782
protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
        return getBeansOfTypeInternal(resolutionContext, beanType, null);
    }
325316
private static <L> Map<Name, TypeSet<ResourceType<L>>> buildTypeMapForConstructor(
            Collection<ResourceType<L>> allTypes) {
        TypeSetBuilder<ResourceType<L>> bldr = TypeSet.<ResourceType<L>> builder();
        bldr.enabled(true);
        bldr.name(new Name("all"));
        for (ResourceType<L> type : allTypes) {
            bldr.type(type);
        }
        TypeSet<ResourceType<L>> typeSet = bldr.build();

        return Collections.singletonMap(typeSet.getName(), typeSet);
    }
743965
public static Function<Object, Collection<?>> COLLECTION(final Class<? extends Collection> collectionType) {
      return as(new CollectionConverterImpl<>(collectionType, null));
   }
989159
public static <T> TypeChecker<List<? extends T>> tList(TypeChecker<? extends T> elementChecker) {
        return new CollectionTypeChecker<>(List.class, elementChecker);
    }
1122033
private Constructor getCollectionProxyConstructor(Class collectionClass)
    {
        if(List.class.isAssignableFrom(collectionClass))
        {
            return getListProxyConstructor();
        }
        else if(Set.class.isAssignableFrom(collectionClass))
        {
            return getSetProxyConstructor();
        }
        else
        {
            return getCollectionProxyConstructor();
        }
    }
390509
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) {
		FeatureCollection dto = new FeatureCollection(layer);
		String type = JsonService.getStringValue(jsonObject, "type");
		if ("FeatureCollection".equals(type)) {
			JSONArray features = JsonService.getChildArray(jsonObject, "features");
			for (int i = 0; i < features.size(); i++) {
				dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer));
			}
		} else if ("Feature".equals(type)) {
			dto.getFeatures().add(createFeature(jsonObject, layer));
		}
		return dto;
	}
1306252
private static <T> T mapByIndex(byte[] content, Class<T> genericType, ObjectMetaData objectMap, Charset charset)
            throws InstantiationException, IllegalAccessException, InvocationTargetException {

        List<FieldMetaData> mappingFields = objectMap.getFieldList();
        T obj = genericType.newInstance();
        for (int i = 0; i < mappingFields.size(); i++) {
            FieldMetaData field = mappingFields.get(i);
            // 设置属性值
            LOGGER.debug("设置值是 " + field + field.getValue(content, charset));
            BeanUtils.setProperty(obj, field.getFieldName(), field.getValue(content, charset));
        }

        return obj;
    }
1001671
@Override
	public <T> List<T> collect(final Class<T> type) {
		try (Stream<T> stream = stream(new EntityResultSetConverter<>(type, new PropertyMapperManager()))) {
			return stream.collect(Collectors.toList());
		}
	}
1285779
public static <E, T extends Collection<E>> T unmarshallCollectionUnbounded(ObjectInput in, UnboundedCollectionBuilder<E, T> builder) throws IOException, ClassNotFoundException {
      final int size = unmarshallSize(in);
      if (size == NULL_VALUE) {
         return null;
      }
      T collection = Objects.requireNonNull(builder, "UnboundedCollectionBuilder must be non-null").build();
      for (int i = 0; i < size; ++i) {
         //noinspection unchecked
         collection.add((E) in.readObject());
      }
      return collection;
   }
973914
public static <T, C extends Collection<T>> Map<T, C> makeElementsToContainersMap(
      final Iterable<C> collections) {
    final ImmutableMap.Builder<T, C> ret = ImmutableMap.builder();

    for (final C collection : collections) {
      for (final T item : collection) {
        ret.put(item, collection);
      }
    }

    return ret.build();
  }