Reformat Adapter Pattern - Issue #224

This commit is contained in:
Ankur Kaushal 2015-11-01 17:26:57 -05:00
parent c0c21ebd91
commit 95c16200e7
6 changed files with 54 additions and 57 deletions

View File

@ -2,26 +2,25 @@ package com.iluwatar.adapter;
/**
*
* An adapter helps two incompatible interfaces to work together. This is the real
* world definition for an adapter. Interfaces may be incompatible but the inner
* functionality should suit the need. The Adapter design pattern allows otherwise
* incompatible classes to work together by converting the interface of one class
* into an interface expected by the clients.
* An adapter helps two incompatible interfaces to work together. This is the real world definition
* for an adapter. Interfaces may be incompatible but the inner functionality should suit the need.
* The Adapter design pattern allows otherwise incompatible classes to work together by converting
* the interface of one class into an interface expected by the clients.
* <p>
* There are two variations of the Adapter pattern: The class adapter implements
* the adaptee's interface whereas the object adapter uses composition to
* contain the adaptee in the adapter object. This example uses the object
* adapter approach.
* There are two variations of the Adapter pattern: The class adapter implements the adaptee's
* interface whereas the object adapter uses composition to contain the adaptee in the adapter
* object. This example uses the object adapter approach.
* <p>
* The Adapter ({@link GnomeEngineer}) converts the interface of the target class
* ({@link GoblinGlider}) into a suitable one expected by the client
* ({@link GnomeEngineeringManager}).
* The Adapter ({@link GnomeEngineer}) converts the interface of the target class (
* {@link GoblinGlider}) into a suitable one expected by the client ({@link GnomeEngineeringManager}
* ).
*
*/
public class App {
/**
* Program entry point
*
* @param args command line args
*/
public static void main(String[] args) {

View File

@ -8,5 +8,4 @@ package com.iluwatar.adapter;
public interface Engineer {
void operateDevice();
}

View File

@ -2,8 +2,8 @@ package com.iluwatar.adapter;
/**
*
* Adapter class. Adapts the interface of the device ({@link GoblinGlider}) into
* {@link Engineer} interface expected by the client ({@link GnomeEngineeringManager}).
* Adapter class. Adapts the interface of the device ({@link GoblinGlider}) into {@link Engineer}
* interface expected by the client ({@link GnomeEngineeringManager}).
*
*/
public class GnomeEngineer implements Engineer {
@ -20,5 +20,4 @@ public class GnomeEngineer implements Engineer {
glider.gainSpeed();
glider.takeOff();
}
}