File tree Expand file tree Collapse file tree 5 files changed +68
-0
lines changed
src/main/java/com/iluwatar Expand file tree Collapse file tree 5 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <project xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <parent >
6+ <groupId >com.iluwatar</groupId >
7+ <artifactId >java-design-patterns</artifactId >
8+ <version >1.0-SNAPSHOT</version >
9+ </parent >
10+ <groupId >com.iluwatar</groupId >
11+ <artifactId >adapter</artifactId >
12+ <version >1.0-SNAPSHOT</version >
13+ <name >adapter</name >
14+ <url >http://maven.apache.org</url >
15+ <dependencies >
16+ <dependency >
17+ <groupId >junit</groupId >
18+ <artifactId >junit</artifactId >
19+ <version >3.8.1</version >
20+ <scope >test</scope >
21+ </dependency >
22+ </dependencies >
23+ </project >
Original file line number Diff line number Diff line change 1+ package com .iluwatar ;
2+
3+ public class App
4+ {
5+ public static void main ( String [] args )
6+ {
7+ GnomeEngineerAdapter engineer = new GnomeEngineerAdapter ();
8+ engineer .flyGoblinGlider ();
9+ }
10+ }
Original file line number Diff line number Diff line change 1+ package com .iluwatar ;
2+
3+ public class GnomeEngineerAdapter {
4+
5+ private GoblinGlider glider ;
6+
7+ public GnomeEngineerAdapter () {
8+ glider = new GoblinGlider ();
9+ }
10+
11+ public void flyGoblinGlider () {
12+ glider .attachGlider ();
13+ glider .gainSpeed ();
14+ glider .takeOff ();
15+ }
16+
17+ }
Original file line number Diff line number Diff line change 1+ package com .iluwatar ;
2+
3+ public class GoblinGlider {
4+
5+ public void attachGlider () {
6+ System .out .println ("glider attached" );
7+ }
8+
9+ public void gainSpeed () {
10+ System .out .println ("gaining speed" );
11+ }
12+
13+ public void takeOff () {
14+ System .out .println ("lift-off!" );
15+ }
16+
17+ }
Original file line number Diff line number Diff line change 2323 <module >factory-method</module >
2424 <module >prototype</module >
2525 <module >singleton</module >
26+ <module >adapter</module >
2627 </modules >
2728</project >
You can’t perform that action at this time.
0 commit comments