|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Implementers can enrich their objects with external Objects implementing certain interfaces. If a class implements Extendable then it always should implement Narrowable too. A typical use-case would be:
public SampleClass implements Extendable, Narrowable {
...
}
SampleClass obj = new SampleClass();
obj.extend(SomeInterface.class, someObj);
....
SomeInterface newObj = (SomeInterface)obj.narrow(SomeInterface.class);
Narrowable| Method Summary | |
void |
extend(Class interfaceClass,
Object extension)
Adds an extension to the class, an interface with its implementation. |
| Method Detail |
public void extend(Class interfaceClass,
Object extension)
Can later be used via narrow(Class)
if the class implements Narrowable.
interfaceClass - the interface of the extension being addedextension - a implementation of the interfaceClass
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||