1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.service.importer.support;
18
19 import java.util.List;
20 import java.util.Set;
21 import java.util.SortedSet;
22
23 import org.springframework.core.enums.StaticLabeledEnum;
24
25 /**
26 * Enumeration-like class which indicates the supported Spring DM managed OSGi
27 * service collection types. This class is used mainly for configuration
28 * purposes (such as parsing the OSGi namespace).
29 *
30 * @author Costin Leau
31 */
32 public class CollectionType extends StaticLabeledEnum {
33
34 private static final long serialVersionUID = 6165756098619186329L;
35
36 /** unused */
37
38
39 /**
40 * Spring-managed list. The returned collection with implement the
41 * {@link List} interface.
42 *
43 * @see java.util.List
44 */
45 public static final CollectionType LIST = new CollectionType(2, "LIST", List.class);
46
47 /**
48 * Spring-managed set. The returned collection with implement the
49 * {@link Set} interface.
50 *
51 * @see java.util.Set
52 */
53 public static final CollectionType SET = new CollectionType(3, "SET", Set.class);
54
55 /**
56 * Spring-managed sorted list. The returned collection with implement the
57 * {@link List} interface.
58 *
59 * @see java.lang.Comparable
60 * @see java.util.Comparator
61 * @see java.util.List
62 * @see java.util.SortedSet
63 */
64 public static final CollectionType SORTED_LIST = new CollectionType(4, "SORTED_LIST", List.class);
65
66 /**
67 * Spring-managed sorted Set. The returned collection with implement the
68 * {@link SortedSet} interface.
69 *
70 * @see java.lang.Comparable
71 * @see java.util.Comparator
72 * @see java.util.SortedSet
73 */
74 public static final CollectionType SORTED_SET = new CollectionType(5, "SORTED_SET", SortedSet.class);
75
76 /** collection type */
77 private final Class collectionClass;
78
79
80 /**
81 * Returns the actual collection class used underneath.
82 *
83 * @return collection class
84 */
85 Class getCollectionClass() {
86 return collectionClass;
87 }
88
89 private CollectionType(int code, String label, Class collectionClass) {
90 super(code, label);
91 this.collectionClass = collectionClass;
92 }
93 }