1 //----------------------------------------------------------------------
2 //
3 // PerfectJPattern: "Design patterns are good but components are better!"
4 // ISurrogate.java Copyright (c) 2009 Giovanni Azua Garcia
5 // bravegag@hotmail.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 3
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, see <http://www.gnu.org/licenses/>.
19 //
20 //----------------------------------------------------------------------
21 package org.perfectjpattern.core.api.structural;
22
23 import java.lang.reflect.*;
24
25 /**
26 * Base abstraction for any Design Pattern type whose structure is based on
27 * surrogation or wrapping. Surrogate Design Patterns are those that for some
28 * purpose wrap and provide to clients the same interface view of the actual
29 * wrapped <code>Component</code> interface. <br/><br/>
30 *
31 * Structural surrogate Patterns are:
32 *
33 * <ul>
34 * <li>Adapter Pattern</li>
35 * <li>Composite Pattern</li>
36 * <li>Decorator Pattern</li>
37 * <li>Proxy Pattern</li>
38 * </ul>
39 *
40 * @param <C> <code>Component</code> or wrapper element type
41 *
42 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
43 * @version $Revision: 1.0 $Date: Apr 5, 2008 3:44:45 PM $
44 */
45 public
46 interface ISurrogate<C>
47 extends InvocationHandler
48 {
49 //------------------------------------------------------------------------
50 // public
51 //------------------------------------------------------------------------
52 /**
53 * Returns the <code>Component</code> interface view <code><C></code>
54 * of this <code>ISurrogate</code><br/><br/>
55 * Client code calls this method to receive an instance of type <code
56 * ><C></code> making accessible the Component business methods
57 * while the underlying implementation is wrapped by this surrogate.
58 *
59 * @return <code>Component</code> interface view <code><C></code>
60 * of this <code>ISurrogate</code> type
61 */
62 public C
63 getComponent();
64 }