Recommended sites

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits
Proxy Print E-mail
User Rating: / 1
PoorBest 
Thursday, 20 January 2005 21:41
Provide a surrogate or placeholder for another object to control access to it. Options are provided to implement all interfaces of the subject class as well as all of the public methods of the subject class



Source Code

/**
 * Represents a proxy for Subject
 */
public class Proxy extends Subject {
	/**
	 * Holds the subject instance.
	 */
	private Subject subject;

	/** @see patterns.gof.proxy.Subject#sampleMethod() */
	public int sampleMethod() {
		return subject.sampleMethod();
	}
}

/**
 * Represents a real subject
 */

public class RealSubject extends Subject {
	public int sampleMethod() {
		/* something happens here */
		return 0;
	}
}

/**
 * Represents a subject
 * 
 * @role __Subject
 */

public abstract class Subject {
	/**
	 * This is sample method to be called by proxy
	 */
	public abstract int sampleMethod();
}
Comments
Add New Search RSS
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:):grin;)8):p:roll:eek:upset:zzz:sigh:?:cry
:(:x
Please input the anti-spam code that you can read in the image.

3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Saturday, 18 June 2005 00:13 )
 


Another articles:


Content View Hits : 2426386

Enter Amount: