View Javadoc
1//----------------------------------------------------------------------2// 3// PerfectJPattern: "Design patterns are good but components are better!" 4// Decorator.java Copyright (c) 2009 Giovanni Azua Garcia5// bravegag@hotmail.com6// 7// This program is free software; you can redistribute it and/or8// modify it under the terms of the GNU General Public License9// as published by the Free Software Foundation; either version 310// 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 of14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15// GNU General Public License for more details.16//17// You should have received a copy of the GNU General Public License18// along with this program; if not, see <http://www.gnu.org/licenses/>.19//20//----------------------------------------------------------------------21package org.perfectjpattern.core.structural.proxy; 2223import org.perfectjpattern.core.api.structural.proxy.*; 24import org.perfectjpattern.core.structural.*; 252627/**28 * Componentized implementation of <code>IProxy</code> interface. Provides29 * special access to the underlying Subject.<br/>30 * 31 * @param <C> Decorated Component type32 * 33 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>34 * @version $Revision: 1.0 $ $Date: Nov 25, 2007 3:15:23 PM $35 */36publicabstract37class AbstractProxy<C> 38extends AbstractSurrogate<C, C> 39 implements IProxy<C> 40 { 41//------------------------------------------------------------------------42// public43//------------------------------------------------------------------------44/**45 * Creates a <code>Proxy&lt;E&gt;</code> from a Component interface 46 * type and instance.47 * 48 * @param anInterface The Component interface type.49 * @param aComponent The Component instance to Decorate.50 * @throws IllegalArgumentException 'anInterface' must not be null.51 * @throws IllegalArgumentException 'anInterface' must be an interface type.52 * @throws IllegalArgumentException 'aComponent' must not be null.53 */54public55AbstractProxy(Class<C> anInterface, C aComponent) 56throws IllegalArgumentException 57 { 58super(anInterface, aComponent); 59 } 6061//------------------------------------------------------------------------62/**63 * {@inheritDoc}64 */65publicfinal C 66 getSubject() 67 { 68return getComponent(); 69 } 7071//------------------------------------------------------------------------72/**73 * {@inheritDoc}74 */75publicfinal C 76 getRealSubject() 77 { 78return getUnderlying(); 79 } 80 } 

close