
/**
* Defines Abstraction interface. Stores reference to implementation.
*
* @role __Abstraction
*/
public abstract class Abstraction {
/** Reference to actual implementation */
private Implementor impl;
/**
* @return implementation-in-action.
*/
protected Implementor getImplementor() {
return impl;
}
/**
* This sample operation delegates call to particular implementation
*/
public void someOperation() {
getImplementor().someOperationImpl();
}
}
/**
* Concrete implementation
*/
public class ConcreteImplementorA extends Implementor {
/** @see patterns.gof.bridge.Implementor#someOperationImpl() */
public void someOperationImpl() {
// provide implementation here
}
}
/**
* Concrete implementation
*/
public class ConcreteImplementorB extends Implementor {
/** @see patterns.gof.bridge.Implementor#someOperationImpl() */
public void someOperationImpl() {
// provide implementation here
}
}
/**
* Defines interface for implementation classes. Is not oblidged to provide
* one-to-one correspondence to interface of Abstraction.
*
* @role __Implementor
*/
public abstract class Implementor {
/** Implement this method to provide implementation-specific behavior */
public abstract void someOperationImpl();
}
Privacy Statement | Copyright Notice | Licenses
© 1999-2012 Waltercedric.com. Designed by Cédric Walter. Sitemap
Reproduction without explicit permission is prohibited. All Rights Reserved. All photos remain copyright © their rightful owners. No copyright infringement is intended.
Disclaimer: The editor(s) reserve the right to edit any comments that are found to be abusive, offensive, contain profanity, serves as spam, is largely self-promotional, or displaying attempts to harbour irrelevant text links for any purpose.