|
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();
}
|
|
Last Updated ( Saturday, 18 June 2005 00:13 )
|
Anyone has a tutorial for developing ...
what type of antifreeze do i use in m...
css lessons - css scrollbar examples ...
SILLY
Now I can stand at the station watchi...