1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.morph.reflect.reflectors;
17
18 import java.util.HashSet;
19 import java.util.Set;
20
21 import net.sf.morph.reflect.GrowableContainerReflector;
22 import net.sf.morph.reflect.InstantiatingReflector;
23
24 /**
25 * Exposes the information found in a {@link java.util.Set}.
26 *
27 * @author Matt Sgarlata
28 * @since Nov 26, 2004
29 */
30 public class SetReflector
31 extends CollectionReflector
32 implements GrowableContainerReflector, InstantiatingReflector {
33
34 private static final Class[] REFLECTABLE_TYPES = new Class[] { Set.class };
35
36 protected Object newInstanceImpl(Class interfaceClass, Object parameters) throws Exception {
37 return interfaceClass == Set.class ? new HashSet() : super.newInstanceImpl(interfaceClass, parameters);
38 }
39
40 public Class[] getReflectableClassesImpl() {
41 return REFLECTABLE_TYPES;
42 }
43
44 }