类 CustomCollectionEditor

  • 所有已实现的接口:
    PropertyEditor

    public class CustomCollectionEditor
    extends PropertyEditorSupport
    Property editor for Collections, converting any source Collection to a given target Collection type.

    By default registered for Set, SortedSet and List, to automatically convert any given Collection to one of those target types if the type does not match the target property.

    从以下版本开始:
    1.1.3
    作者:
    Juergen Hoeller
    另请参阅:
    Collection, Set, SortedSet, List
    • 构造器详细资料

      • CustomCollectionEditor

        public CustomCollectionEditor​(Class<? extends Collection> collectionType,
                                      boolean nullAsEmptyCollection)
        Create a new CustomCollectionEditor for the given target type.

        If the incoming value is of the given type, it will be used as-is. If it is a different Collection type or an array, it will be converted to a default implementation of the given Collection type. If the value is anything else, a target Collection with that single value will be created.

        The default Collection implementations are: ArrayList for List, TreeSet for SortedSet, and LinkedHashSet for Set.

        参数:
        collectionType - the target type, which needs to be a sub-interface of Collection or a concrete Collection class
        nullAsEmptyCollection - whether to convert an incoming null value to an empty Collection (of the appropriate type)
        另请参阅:
        Collection, ArrayList, TreeSet, LinkedHashSet