#107 JavaDoc improvements for the Adapter example

This commit is contained in:
Ilkka Seppala
2015-08-17 23:11:15 +03:00
parent fd85a2f848
commit ef6a34ef74
3 changed files with 69 additions and 65 deletions

View File

@ -1,21 +1,25 @@
package com.iluwatar.adapter; package com.iluwatar.adapter;
/** /**
* *
* There are two variations of the Adapter pattern: The class adapter implements * There are two variations of the Adapter pattern: The class adapter implements
* the adaptee's interface whereas the object adapter uses composition to * the adaptee's interface whereas the object adapter uses composition to
* contain the adaptee in the adapter object. This example uses the object * contain the adaptee in the adapter object. This example uses the object
* adapter approach. * adapter approach.
* * <p>
* The Adapter (GnomeEngineer) converts the interface of the target class * The Adapter ({@link GnomeEngineer}) converts the interface of the target class
* (GoblinGlider) into a suitable one expected by the client * ({@link GoblinGlider}) into a suitable one expected by the client
* (GnomeEngineeringManager). * ({@link GnomeEngineeringManager}).
* *
*/ */
public class App { public class App {
public static void main(String[] args) { /**
Engineer manager = new GnomeEngineeringManager(); * Program entry point
manager.operateDevice(); * @param args command line args
} */
} public static void main(String[] args) {
Engineer manager = new GnomeEngineeringManager();
manager.operateDevice();
}
}

View File

@ -1,24 +1,24 @@
package com.iluwatar.adapter; package com.iluwatar.adapter;
/** /**
* *
* Adapter class. Adapts the interface of the device (GoblinGlider) into * Adapter class. Adapts the interface of the device ({@link GoblinGlider}) into
* Engineer interface expected by the client (GnomeEngineeringManager). * {@link Engineer} interface expected by the client ({@link GnomeEngineeringManager}).
* *
*/ */
public class GnomeEngineer implements Engineer { public class GnomeEngineer implements Engineer {
private GoblinGlider glider; private GoblinGlider glider;
public GnomeEngineer() { public GnomeEngineer() {
glider = new GoblinGlider(); glider = new GoblinGlider();
} }
@Override @Override
public void operateDevice() { public void operateDevice() {
glider.attachGlider(); glider.attachGlider();
glider.gainSpeed(); glider.gainSpeed();
glider.takeOff(); glider.takeOff();
} }
} }

View File

@ -1,20 +1,20 @@
package com.iluwatar.adapter; package com.iluwatar.adapter;
/** /**
* *
* GnomeEngineering manager uses Engineer to operate devices. * GnomeEngineering manager uses {@link Engineer} to operate devices.
* *
*/ */
public class GnomeEngineeringManager implements Engineer { public class GnomeEngineeringManager implements Engineer {
private Engineer engineer; private Engineer engineer;
public GnomeEngineeringManager() { public GnomeEngineeringManager() {
engineer = new GnomeEngineer(); engineer = new GnomeEngineer();
} }
@Override @Override
public void operateDevice() { public void operateDevice() {
engineer.operateDevice(); engineer.operateDevice();
} }
} }