FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DesignPatterns/AbstractFactory/src/Main.java at master · feisuo/DesignPatterns · GitHub
feisuo
/
DesignPatterns
Public
forked from
hazukac/DesignPatterns
Notifications
You must be signed in to change notification settings
Fork
2
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DesignPatterns
/
AbstractFactory
/
src
/
Main.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (30 loc) · 1.35 KB
Breadcrumbs
DesignPatterns
/
AbstractFactory
/
src
/
Main.java
Copy path
File metadata and controls
33 lines (30 loc) · 1.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import
factory
.*;
public
class
Main
{
public
static
void
main
(
String
[]
args
) {
if
(
args
.
length
!=
1
) {
System
.
out
.
println
(
"使うファクトリ指定してくれ〜"
);
System
.
exit
(
0
);
}
Factory
factory
=
Factory
.
getFactory
(
args
[
0
]);
Page
page
=
factory
.
createPage
(
"アニメのキャラ"
,
"otiai10"
);
Tray
htt
=
factory
.
createTray
(
"放課後ティータイム"
);
Link
ritsu
=
factory
.
createLink
(
"田井中律"
,
"http://images.uncyc.org/ja/8/8c/Ritu.jpg"
);
Tray
muse
=
factory
.
createTray
(
"μ's"
);
Link
nozomi
=
factory
.
createLink
(
"のぞみ"
,
"http://images.uncyc.org/ja/8/8c/Ritu.jpg"
);
htt
.
add
(
ritsu
);
muse
.
add
(
nozomi
);
page
.
add
(
htt
);
page
.
add
(
muse
);
page
.
output
();
}
/**
* アプリケーションレイヤーでは、ページのコンテンツしか定義してない。
* ページの構造や、**つくりかた**についても、アプリケーションは感知してない。
* ページレイアウトの変更があった場合は、具体的なFactoryクラスを
* 新たに作って、指定すればいいだけ。
* ∵
* AbstractなFactoryというクラスを最初に定義して
* Mainはそれだけを参照することで
* 具体的なFactoryに依存しない
*/
}
Back
|
FazBrowse Home
|
New Git URL