1//----------------------------------------------------------------------2// 3// PerfectJPattern: "Design patterns are good but components are better!" 4// Example.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; 2223/**24 * Startup Main for the Proxy Pattern Example code25 *26 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>27 * @version $Revision: 1.0 $Date: Apr 5, 2008 10:11:17 PM $28 */29//CHECKSTYLE:OFF30publicfinal31classExample32// CHECKSTYLE:ON33 { 34//------------------------------------------------------------------------35// public36//------------------------------------------------------------------------37publicstaticvoid38 main(String[] anArguments) 39 { 40//---------------------------------------------------------------41// Create Image wrapped by an ImageProxy42//---------------------------------------------------------------43IGraphic myImage = newImage(); 44IGraphic myImageProxy = newImageProxy(myImage).getSubject(); 4546 assert myImageProxy.equals(myImage) : 47"Identity problems? I thought not!"; 4849//---------------------------------------------------------------50// call any of Image's methods 51//---------------------------------------------------------------52 myImageProxy.crop(); 53 myImageProxy.draw(); 54 } 55 }