1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.composite.specialize;
17
18 /***
19 * Constructs specialized instances of a composite using its components. The
20 * specialized instance is constructed by gathering all the components of the
21 * original composite that are of the designated specialization type. The
22 * specialized instance may be a subtype of the original composite.
23 *
24 * @author Matt Sgarlata
25 * @since Mar 11, 2005
26 */
27 public interface Specializer {
28
29 /***
30 * Determines whether the components in the composite can be used to create
31 * a specialized version of the composite that implements
32 * <code>specializedType</code>.
33 *
34 * @param composite
35 * the composite from which the components will be extracted
36 * @param specializedType
37 * the type to be exposed
38 * @throws SpecializationException
39 * if the new, specialized, composite could not be created
40 */
41 public boolean isSpecializable(Object composite, Class specializedType) throws SpecializationException;
42
43 /***
44 * Uses the components in the composite to create a composite
45 * that implements <code>specializedType</code> and is composed only
46 * those
47 *
48 * @param composite
49 * the composite from which the components will be extracted
50 * @param specializedType
51 * the type to be exposed
52 * @throws SpecializationException
53 * if the new, specialized, composite could not be created
54 */
55 public Object specialize(Object composite, Class specializedType) throws SpecializationException;
56
57 }