Compare commits

..

102 Commits

Author SHA1 Message Date
c5e6dcc11b Reached milestone 1.13.0 2016-09-30 19:38:28 +03:00
6026eedd51 UML generation: Mark the urm-maven-plugin execution to be ignored in Eclipse and recreate all .puml files 2016-09-18 17:51:09 +03:00
b030cd4eba Hexagonal pattern: Introduce lottery utils class 2016-09-17 09:20:33 +03:00
6aa58e8ae6 Hexagonal pattern: Remove unnecessary factories 2016-09-17 09:07:06 +03:00
914d1353a1 Hexagonal pattern: Update test application description 2016-09-15 21:56:15 +03:00
df32a7b893 Hexagonal pattern: Introduced lottery events port with two adapters 2016-09-15 21:45:09 +03:00
c4c5e78e50 Hexagonal pattern: Improve error handling in console lottery 2016-09-14 22:18:42 +03:00
3cf2b34d2a Hexagonal pattern: Improve connection properties handling 2016-09-14 22:01:41 +03:00
27e8cb7f2d Hexagonal pattern: Add separate class for Mongo connection properties 2016-09-14 19:25:26 +03:00
e685512ed5 Hexagonal pattern: Added Mongo based banking adapter and bound it in Guice production module 2016-09-11 23:19:02 +03:00
59e6a0af85 Hexagonal pattern: Ignore Mongo repository test 2016-09-11 22:16:50 +03:00
626c56730c Hexagonal pattern: Added Mongo based ticket repository and set production configuration to use that 2016-09-11 20:02:34 +03:00
a85463470e Hexagonal pattern: Add mongo driver dependency 2016-09-11 13:53:00 +03:00
4410419914 Hexagonal pattern: Simplified lottery ticket ids 2016-09-11 10:34:12 +03:00
e17d72bca8 Hexagonal pattern: Added console interfaces for players and administration. 2016-09-10 14:28:05 +03:00
121ed3cca8 Hexagonal pattern: Move lottery administration and service to the core. Introduce console interfaces for players and administartors. 2016-09-10 07:56:37 +03:00
adc6019c7e Hexagonal pattern: Remove interfaces with only one implementation 2016-09-10 07:14:24 +03:00
0f2807b9cf Hexagonal pattern: More descriptive class names 2016-09-09 21:36:17 +03:00
1b10ddbb73 Hexagonal pattern: Use Guice dependency injection 2016-09-06 22:39:39 +03:00
348e577e8e Hexagonal pattern: Add Guice dependency 2016-09-06 21:39:08 +03:00
22821ba8cc Move Guice to parent pom dependency management section 2016-09-06 21:35:36 +03:00
4493341ba6 add documentation to 'use latest java 8' change 2016-09-04 11:00:24 +02:00
3cb872807e Hexagonal pattern: remove unnecessary repository usage from a unit test 2016-09-04 10:33:26 +03:00
ab68129829 Hexagonal pattern: move business logic to core 2016-09-03 22:02:08 +03:00
e57a0948ef Merge pull request #490 from iluwatar/DocumentUsages
#211 Document GoF usages from Java API
2016-09-03 14:14:13 +03:00
ff23e90c4f Add puml for Promise pattern 2016-09-03 08:43:35 +03:00
fa52a7f77e Run build with latest java 8 release 2016-09-03 00:19:50 +02:00
165d1f1298 Turn Error Tracing on when installing
Travis currently errors and i cant reproduce locally, so this might help finding the culprit
2016-09-02 23:54:52 +02:00
be2c7fdb2b Update URM version: 1.4.0 -> 1.4.1, fixes #492 2016-09-02 23:15:38 +02:00
90c636abd3 Add missing license headers 2016-09-02 21:28:45 +03:00
678a06e7f8 Merge pull request #470 from iluwatar/Promise
Implements #403 Promise pattern
2016-09-02 20:47:21 +03:00
e425c2ef2f Add webhook for travis build failures to gitter
Only the core group (private) gitter room
2016-08-31 13:15:44 +02:00
5c1a4f1caf Added example that mocking frameworks use proxy pattern 2016-08-31 16:12:13 +05:30
58dce1bd89 Work on #190: Commit initial pumlId's added by the script 2016-08-30 15:10:34 +02:00
9dd1503e6f Work on #190: add postPumlsToServer.py python script
Used to initially post all pumls to the plantuml hosting while preserving the pumlId's
2016-08-30 15:07:49 +02:00
09037b0251 Rename index.md to README.md
to conform to our standards, every other file is named README.md
2016-08-30 14:06:14 +02:00
36fe249960 Work on #190: Add first batch of automagically generated puml files 2016-08-30 13:29:12 +02:00
e73867f9a1 Work on #190: Add automagic puml generation in pom.xml's 2016-08-30 13:24:53 +02:00
59cf100302 #403, updated javadocs 2016-08-29 12:04:24 +05:30
ad11ea46b1 Work on #403, javadocs updated 2016-08-29 11:55:30 +05:30
5796e1967f Work on #403, updated diagram and finishing touches 2016-08-29 11:50:33 +05:30
483c61a82a Some refactoring, added javadocs 2016-08-29 00:16:36 +05:30
6575b3ae99 Merge pull request #491 from alexsomai/patch-1
Minor code changes
2016-08-29 00:00:44 +05:30
095adda7e9 Change access level to private 2016-08-26 12:54:20 +03:00
f16ae08bdf Remove extra space 2016-08-26 12:46:30 +03:00
95cf9fe367 Work on #403, made example readable and moved methods into utility 2016-08-22 18:43:29 +05:30
28647cdf48 #211, consistent use of real world examples section in all readme files. 2016-08-20 20:57:48 +05:30
fdcf546112 Merge branch 'master' of https://github.com/iluwatar/java-design-patterns into DocumentUsages 2016-08-20 20:50:30 +05:30
a0c77c32b5 #211 added further examples for structural and behavioral patterns 2016-08-20 20:49:28 +05:30
eb75773891 Added FAQ on Memento pattern
Difference between java Serialization and Memento pattern added
2016-08-20 19:44:48 +05:30
c79df708b1 #211 added real world examples from Java api for creational patterns 2016-08-20 13:17:53 +05:30
56100927a9 Addendum #481
Change page-index for faq.md
2016-08-15 12:33:24 +02:00
7e77216919 remove link, resolves #479
to avoid confusion, the link is removed.
For more information on why this is done please look at the referenced issue
2016-08-15 11:53:39 +02:00
b16d7fc970 Configure Travis notification email 2016-08-14 23:00:27 +03:00
0b36a3153d Fix checkstyle error 2016-08-14 22:42:59 +03:00
7c2f5da926 Add final keyword 2016-08-13 18:28:53 +03:00
ffbc5f2f29 Reorganize LotteryNumbers for easier inclusion in the blog 2016-08-13 17:08:57 +03:00
d50139e13e Merge pull request #478 from iluwatar/DocumentDoubleCheckIdiom
Documented singleton double check idiom
2016-08-05 18:45:00 +03:00
d484e7f731 Documented singleton double check idiom, explaining the dynamics that happen on each step for better understanding. Did this due to a PR #475 2016-08-05 14:38:25 +05:30
76970633b8 Work on #403, incorporate review changes 2016-08-04 18:10:50 +05:30
55028a49dc Merge pull request #476 from sumityadav6541/master
removed extra "is" from javadoc comments
2016-08-04 17:47:37 +05:30
94c3a2caf3 removed extra "is" from the javadoc of InitializingOnDemandHolderIdiom class 2016-08-03 15:02:46 +05:30
547d798528 Merge pull request #1 from iluwatar/master
merging changes into fork from origin
2016-08-03 14:57:07 +05:30
e7be94d2e4 Merge branch 'Promise' of https://github.com/iluwatar/java-design-patterns into Promise 2016-07-29 13:12:33 +05:30
383e4a3a0b Merge branch 'master' of https://github.com/iluwatar/java-design-patterns into Promise 2016-07-29 13:01:51 +05:30
3001fa4a30 Merge pull request #471 from Crossy147/issue-#459
#459 added known alias for monostate pattern
2016-07-27 15:46:17 +03:00
5fcef89384 #459 added known aliast for monostate pattern 2016-07-26 20:33:43 +02:00
40ac552542 Work on #403, added README 2016-07-24 01:45:49 +05:30
09ba5ca656 Work on #403, added class diagrams and javadocs 2016-07-22 18:34:05 +05:30
eb560f5f54 Work on #403, removed checkstyle violations 2016-07-22 16:53:01 +05:30
2b945ca27f Work on #403, removed dependency on async method invocation module, added more tests 2016-07-22 16:47:52 +05:30
4bd1f14cfb Merge branch 'master' of https://github.com/iluwatar/java-design-patterns into Promise 2016-07-22 12:52:54 +05:30
bc94d0fc26 Fix link 2016-07-21 20:21:36 +03:00
102341443d Work on #403, added application class and test cases. 2016-07-21 19:13:42 +05:30
8124fd0771 Adjust pattern categories and tags 2016-07-21 09:27:48 +03:00
ea7503414e Work on #403, added basic implementation of promise pattern 2016-07-20 19:58:20 +05:30
d4c2f0392d Merge pull request #464 from pnowy/#463-chain-of-responsibility
#463 Added javax.servlet.Filter to real world examples intercepting filter
2016-07-18 09:22:34 +03:00
f7b7f15ec8 #463 Added javax.servlet.Filter to real world examples of intercepting filter 2016-07-17 21:24:12 +02:00
0fbbd8dc81 #463 Added javax.servlet.Filter to real world examples of chain 2016-07-17 16:05:07 +02:00
9f0320aeaf Add some tags to Page Object 2016-07-13 00:02:20 +03:00
fe1d760c7f Fix license headers 2016-07-12 19:52:56 +03:00
b46d2deeb0 Merge pull request #434 from colinbut/master
#229 Page Object Pattern
2016-07-12 19:47:48 +03:00
f182e87ee1 fixed app launch 2016-07-10 20:51:52 +01:00
85f432fb54 exclude library class from jacoco code coverage 2016-07-09 22:24:17 +01:00
7be98fa829 added missing licence headers to 2 files 2016-07-09 22:20:13 +01:00
ff8037ee0b Add aliases for Specification pattern 2016-07-07 08:46:56 +03:00
849df50394 Fix formatting 2016-07-04 22:22:37 +03:00
f806c5b712 Add known uses to Factory Method 2016-07-04 21:52:39 +03:00
ef2ada4fdf syncing fork 2016-07-03 21:47:07 +01:00
5d58a1b333 syncing fork 2016-07-03 21:46:38 +01:00
4a069ee93a new class diagrams 2016-07-03 21:36:03 +01:00
88321890c7 remove old class diagram 2016-07-03 21:12:48 +01:00
b1e40d9c92 Feedback changes - final and refactored code 2016-07-03 21:12:09 +01:00
5c26f46174 Set version number for next development iteration 2016-06-30 18:15:26 +03:00
4eac37c6b5 Feedback changes - removed file 2016-06-28 22:04:39 +01:00
c212ee5cb1 Feedback changes - fix dependency in pom 2016-06-28 22:03:57 +01:00
8efaf44170 Feedback changes - sort out dependency 2016-06-28 22:02:03 +01:00
27e4e9afee Feedback changes - restructed project structure 2016-06-28 21:53:55 +01:00
35c0942803 syncing fork 2016-06-27 20:54:45 +01:00
0282d6663f README 2016-06-18 21:08:15 +01:00
c8f04d2f0d added Class Diagram 2016-06-18 19:20:29 +01:00
53fc8b749a Page Object pattern implementation 2016-06-18 15:40:03 +01:00
326 changed files with 9890 additions and 1115 deletions

View File

@ -11,8 +11,28 @@ before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
# default install command is just "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V"
install:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -e
after_success:
- mvn clean test jacoco:report coveralls:report
- bash update-ghpages.sh
# use latest java version available instead of travis default
addons:
apt:
packages:
- oracle-java8-installer
notifications:
email:
- iluwatar@gmail.com
webhooks:
urls:
- https://webhooks.gitter.im/e/3319623945358a093a6f
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
sudo: false # route the build to the container-based infrastructure for a faster build

View File

@ -24,7 +24,7 @@ are familiar with the patterns.
# Getting started
Before you dive into the material, you should be familiar with various
[Programming/Software Design Principles](http://webpro.github.io/programming-principles/).
Programming/Software Design Principles.
All designs should be as simple as possible. You should start with KISS, YAGNI,
and Do The Simplest Thing That Could Possibly Work principles. Complexity and

View File

@ -0,0 +1,190 @@
parent: half-sync-half-async; artifact: half-sync-half-async
Puml Server ID: RScv3SCm3030LU819FRPXg5fIm552tnYPFiyjRi3RkbAaYkdoQr5JBy369vrxz7oaSv6XmPhL3e6TCaJ0msU-CAoilTToyG8DdKOw5z0GzcAlvNAN_WZSD1brBHHPmxv0000
parent: abstract-document; artifact: abstract-document
Puml Server ID: PSjB3eCm34NHhPG599vtDyQn85L-ifzX-p3lxEf8Twj3MXGDQvyJMFubChxpKN767gucSq07iinEjSNDOACVNvoAUZr6MWoe3QVE_WRnxZ0Mf38b-hkIGlurX_MyehS7
parent: tolerant-reader; artifact: tolerant-reader
Puml Server ID: NSZ14SCm20NHLf829ExfXaYChGn26lZ4xSVdtFRjSrZJx9AkZnFOyI9olkenSEOxGxmjWnXgMvE6viLWfmz_kNI9SLZP38XRqEIuWx1Kd0t5XVjjGVj_DNtMdLD_
parent: event-driven-architecture; artifact: event-driven-architecture
Puml Server ID: TOhH3SCW30LNQGS0_tSRnrZ15H1adfFromBzkfFktZQaHT7mzgh0N1yYvoUVXXf7B7Mv1dGWozN9MZmCTlhopQdeidEaoO3wMDHvRI6zzvwAssPYbsfGGRYIGlxN7DxpZDv-
parent: publish-subscribe; artifact: publish-subscribe
Puml Server ID: PSZB3SCm203GLTe1RExT1XCKKs5YyMdMR--zFRsd66aTNAwFcRdZ1U1uzrDorgXWfykIBJjT2qJhnaI7Dtwm7HnoMjkOoMu12-C7s3LKOhQe4UGo63ZfVtlvwhkMVW40
parent: facade; artifact: facade
Puml Server ID: BSP15eCm20N0gxG7CEoz3ILKqvTW7dpq-hhehERTJ7fMJU-l7PYn4ZbVPMlOyvEXBeT13KMEGQtdnM2d7v-yL8sssJ8PKBUWmV64lYnSbHJoRqaVPUReDm00
parent: service-locator; artifact: service-locator
Puml Server ID: NSjB3iCm203HgxG7iDdtDeIWX0fZYqzo_MRTtUX9ynOZhPtBzNLchlW0EDxza3nhgs2dQScMdUO0qRenqU6B5xQTGmvh2pFPBM1WF07FSmbnqqcOqu6J_gsNZxvgw0y0
parent: dao; artifact: dao
Puml Server ID: 5SR14OKW30N0LhG0oVrt4o6ZE12Ov4NR_thQNQlc5aN2sd82qtz4naywAixOmyNoK8WYvT6fjdWOR7JnpLiHhuTkam4nTUhiRwZm847-J64zpUZj3m00
parent: model-view-presenter; artifact: model-view-presenter
Puml Server ID: ROlR3SGW3C1MkGu0-RzjKeXQJWcWFChwPO3xispvQBrmL0hbp-q-xGkWkFBL_8upZBICxjGzbo7GE1OwAlpmmLJ9sjNJH7VIRY1e6q169KvFevMcakrtI_BoD-HGoJE4Nm00
parent: observer; artifact: observer
Puml Server ID: FSkn4OGm30NHLg00hFow4KO3PcpP8tr1-pYwx6smQz5Suv2mkbp0y1-HyPlEWYlsSB7S5Q98kJSgDLu66ztyy7Q8brEtmO2OEZNs2Uhxl9u9GVv72cjfHAiV
parent: intercepting-filter; artifact: intercepting-filter
Puml Server ID: RSfB3i8m303Hgy014k-vZN5DQkIuaJ_q-fGzkz7JtCL8Q-DolUsPAnu0ZcSVadizAzZfi6JBJiS4qJenqU6D7smRXmnh2pFPBM1YN05o_KwyKcoqb-ZFEEcVz_BPLqtz0W00
parent: factory-method; artifact: factory-method
Puml Server ID: NSZB3G8n30N0Lg20n7UwCOxPP9MVx6TMT0zdRgEvjoazYeRrMmMsFuYChtmqr7Y6gycQq8aiQr3hSJ7OwEGtfwBUZfas0shJQR3_G2yMBFkaeQYha4B-AeUDl6FqBm00
parent: private-class-data; artifact: private-class-data
Puml Server ID: RShR3SCm243HLTe1RFwx3S4eeSB4uf6itmpGlwkZ-nOZhS7b-ZeoLtm07E--InwrLR3JQScMdSu9edLZeiCNBso3GtPh2pFPBM1YF07BvSBaHeeHRJm_SD8VxkMphvhw0m00
parent: async-method-invocation; artifact: async-method-invocation
Puml Server ID: TSdB3SCW303GLTe1mFTkunWhk0A3_4dKxTi5UdlIUuhIoCPfuz4Zjhy03EzwIlGyqjbeQR16fJL1HjuOQF362qjZbrFBnWWsTPZeFm3wHwbCZhvQ4RqMOSXIuA1_LzDctJd75m00
parent: execute-around; artifact: execute-around
Puml Server ID: NSZ14G8n20NGLhI0XBlT865suoGa0n_NylNixSsxTvEHJTF7xGHsF8YShtfqdFdCK9TbK4ELDQcFl1ZizE8tbwRH3okR0NKBcXm_a7vK4bhOLreZXVnLJPzrvnnV
parent: monostate; artifact: monostate
Puml Server ID: HSV14OGm20NGLjO23FVj1YEZsGaa0nzjVxrvUszfLdlkaju_9p3ZI-HybwFXp2r3l0w364eTIgtdpM2d7r-yxXBji7Ko86v1ol60TDW8C8G4zLr9rp9J-ny0
parent: thread-pool; artifact: thread-pool
Puml Server ID: JSV14SCW30J0Lk82GFzq8uF6a1624IUx_UIPt-xHhMXK2TTN0zP-4pa_-UfeSSOMBzCWXbpceAxnCDZfmpUdAhjVbXO3uhPfyFw1q5oufZMdag3yFuUFl6Be5m00
parent: delegation; artifact: delegation
Puml Server ID: JSV14GCX20NGLf82LkxfXbN69OFeu2VRVdBCxRsdUhLiac6F2rZxHHHybwwuyimjKQT37ANEGMfvCpZepHy-ccpjVYm697pJuFq3DJ7f39rEWlhNaZ7Aoc5V
parent: chain; artifact: chain
Puml Server ID: 9SR13SCm20NGLTe1OkxTXX0KKzd4Wa-pVYlrdTxJN4OTMZ4U7LZv8Wg-ssdejLTgoELGHvDhaesw6HpqvWzlXwQTlYq6D3nfSlv2qjcS5F9VgvXjrHnV
parent: resource-acquisition-is-initialization; artifact: resource-acquisition-is-initialization
Puml Server ID: ZShR3S8m343HLUW0YV_PnhXMQvGumOzMOdhA1lqxkhgBABLSEQqzzeZfJm33isuIUxxIsMXei4QbqK5QdXXeyCO3oyekcvQ94MpgqD4lWB6FDEA2z4bn2HbQn8leHMponNy13hgvrhHUP_Rs0m00
parent: fluentinterface; artifact: fluentinterface
Puml Server ID: NOj93eCm302_KXv0VEzlN6F0bMCYB_3zvjpRQ3IpY97MnkNwEZD7l04SdtP8dlMfOAVBaYqRNHr4wy54Xo_Uk6uSSjWwC9FT0Zh61DYrPY_pyXs9WPF-NIllRLJN7m00
parent: service-layer; artifact: service-layer
Puml Server ID: LOl93SCm3C1MQGUmzUysgY8aAcJ5q96WszVV_aW2V8gHriRb-ZWoPxm07E--Inxrhc2dqv8jEvq3HEl6H8SFNjWs3jcjJSnaju21iG3MSmbnK_mkuwJ_qij7dpNq1m00
parent: visitor; artifact: visitor
Puml Server ID: DSR14OGm20NGLhG0mtsxmSWeJa8oyD7sTo_xJczLgoqFIM_B1Spu43c_vLHSkMU8rs4GGwcZaxPy6UnqyyFR8Q6dRPC1SGlg7B_Gew4OJeBwVqdlPMPlNm00
parent: double-dispatch; artifact: double-dispatch
Puml Server ID: NSbB3iCW303HgpG70Ezx6yTOWSeOv4zp_MRTtUZDCPGa6wV9gqTiVmCOtlKQqVDCPwEbmHgLreGXUMEWmGU_M1hxkBHiZ61JXud-1BILft1fmvz37JZetshQh3kd_000
parent: monad; artifact: monad
Puml Server ID: 9SR13SCm20NGLPe1OkxTXjWeSMMm1Pza_LRgExsjMntP97syBc35cyZvAMV7bKU6U9q6CPGwbVh8Xy5E7xvvRnBzj7qn86v1ol4BwJHk9AZ_bNGjAtLy0G00
parent: front-controller; artifact: front-controller
Puml Server ID: PSlB3OGm303HLfO24j-t6nCC13bEvC_IFk6yjz6JPgbIE3OAvS_fFkmBe7Zde_ePQnXfwU8adajlK3bkT5Iuy8Tf8wk7f87kf6BGq6R0hlD8xwQTUG9v-SCSslA8nWy0
parent: strategy; artifact: strategy
Puml Server ID: FSV13OCm30NGLM00udktCS4AGOaJsTz5tRwSkBstLiqj3WbhombC_n0PtwbKdB67Y-MX44NAerDjSJFOwE8lRuTuBRfD1iJKgRC_88SnfFn8aD-ai9vczFO7
parent: command; artifact: command
Puml Server ID: DSgn4OCm30NGLM00h3xR25i7vYpXaxx2-g59zugtTgiZcwIFvGHcV8YSdt9qdBbdYDVR88PIRwK-yc6mqyLVtff4FsoR38XRa7Aye3SgMoD1_RkaQvcfumS0
parent: abstract-factory; artifact: abstract-factory
Puml Server ID: PSZB3OD034NHLa81Czwd6sCC39gVxEUWT1_ssLmTtQLqgR5fM7sTmFGtaV6TZu8prd0r6HtQaMKqAZLk1XjT_E6qgPUZfyc0MdTgx0-8LuUn8ErFXdr98NypXxKyezKV
parent: flux; artifact: flux
Puml Server ID: 7SP14eCm20NGg-W13FlU1YFLE0GpyAazVZk-rPkRLSrDqdKwW14l8kUxx0r7hXdYzJA8eTIhKzEy6UnqyeUNJQBjjWm6n2seS_n3Ryql2UgJajxBoAu_
parent: event-aggregator; artifact: event-aggregator
Puml Server ID: PSf13iCW30NHgxG70Ezx6uTOX0eCih-JwvTzTwEdUJSjFKu9wwyBMFuXCdvoRRZY21ShKo6ANEQWrkDXiD6NRqwdUAkQ5WDYwZJOTv3SUqzSgqbbp0qeVvZ3Hbun-Wy0
parent: singleton; artifact: singleton
Puml Server ID: HSV14SCm20J0Lk82BFxf1ikCh0n26ZZizfDVVhjRjwfvIhg-Bc35cyZvAQtZoYD3l4w364gTWxhcms2d3z-ydnAzsRuO4BUWmV43HRUcWcaagF-Lz55M3lq2
parent: null-object; artifact: null-object
Puml Server ID: JSV14SCm20J0Lk829Fxf1cF6bWSX3JhYzfDdVhjRSx4yDCDU5p3NcoZugMV3bNik3HaETLGPdPhbm-2WcpzS3btjz38PqF15dTSFv6bMndwhW1Jo_vhHwynkNm00
parent: multiton; artifact: multiton
Puml Server ID: FST14i8m20NGg-W16lRUXgPCYnD81Zxs-hfozzvJlOywf68yBc3bYoZuRgVYghrIea-7E5gVHZhgPd3Gcp-y7P9w-hOOaF0au_o1h0OKqqdG_saLrbRP-080
parent: composite; artifact: composite
Puml Server ID: HSf13eCm30NHgy01YFUzZGaM62LEP7-NwvTTT_EaMTLgoqFIst81Cpv4payv5LVk6U9r6CHGwkYaBHy6EztyvUsGqDEsoO2u1NMED-WTvmY5aA3-LT9xcTdR3m00
parent: api-gateway; artifact: image-microservice
Puml Server ID: 3Sp13SCm2030LTe1RFxTXX3aK1biOOZLxPlVlUujHZrFJk-lAsAk3u3ZhatYoYCNEmqBjgWq5AJdna27BzvOJbxIh4oCOBS5Yki1u9JIC7ZZ3pW8HB5nKI4VJtSBSKtNEbFx7m00
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'api-gateway/etc/image-microservice.urm.puml'
pumlid: 3Sp13SCm2030LTe1RFxTXX3aK1biOOZLxPlVlUujHZrFJk-lAsAk3u3ZhatYoYCNEmqBjgWq5AJdna27BzvOJbxIh4oCOBS5Yki1u9JIC7ZZ3pW8HB5nKI4VJtSBSKtNEbFx7m00
parent: api-gateway; artifact: api-gateway-service
Puml Server ID: JSox3SCm303HLP819FRUXg49cO542_nOyFPncUvUSszHwhbpMdyT4TCt0CDLcyIHdtGsEZLOez8vG7ek33JuueLbPvUcPM84cpeCz2S0fvI6mGjluA1_b-Tt2N5D6tNcw3y0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'api-gateway/etc/api-gateway-service.urm.puml'
pumlid: JSox3SCm303HLP819FRUXg49cO542_nOyFPncUvUSszHwhbpMdyT4TCt0CDLcyIHdtGsEZLOez8vG7ek33JuueLbPvUcPM84cpeCz2S0fvI6mGjluA1_b-Tt2N5D6tNcw3y0
parent: api-gateway; artifact: price-microservice
Puml Server ID: 3Sn13iGW243HgqmFeEpdDfGIoqJK8DJqzkFklyq_f56DYyFgvtOVymjWk78Hl-ECoKQzEJVFr1Mana97Wny-c2wUKbeQwCxM9YZE7O13Ka7dXI-m4mmJugH2rlVksSXXcaTe_GC0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'api-gateway/etc/price-microservice.urm.puml'
pumlid: 3Sn13iGW243HgqmFeEpdDfGIoqJK8DJqzkFklyq_f56DYyFgvtOVymjWk78Hl-ECoKQzEJVFr1Mana97Wny-c2wUKbeQwCxM9YZE7O13Ka7dXI-m4mmJugH2rlVksSXXcaTe_GC0
parent: object-pool; artifact: object-pool
Puml Server ID: JSV94SCm2030Lk829Fxf1cF6bWU1XYDkFtdcjxiD9Qc3o-LrPQvu0pW-_HnvrLx1JgR9cfrimf1wCD7XnW-sWsESsXPcicl0nFW1RB-PiYqp0KxwVo-VVTMKBm00
parent: adapter; artifact: adapter
Puml Server ID: DSR14S8m30J0Lg20M7-wEMnDOiPMFDA9j0yyUEtUkzMHJTF7xI1NF4GSLzaxZtncgDVJgCPIpobzv0N2vOKtjgRHTziMI7KBcOXl10thfxB-Nz9dMJd71m00
parent: hexagonal; artifact: hexagonal
Puml Server ID: HSTB4W8X30N0g-W1XkozpPD90LO8L3wEnzUTk-xxq2fvSfhSUiJs1v7XAcr4psSwMrqQh57gcZGaBmICNdZZEDb7qsCZWasT9lm7wln1MmeXZlfVIPjbvvGl
parent: value-object; artifact: value-object
Puml Server ID: LSZ13SCm20NGLTe1RExTXX2KECBOmfza_VRQszDxDnVBNJFiTG9pVOY2dteqdBdbqf3XK4ULqQbPFWmEklZcikjgXvV9W8Olwhn-e9ijjOpjKW4fv2zgHgypktq1
parent: twin; artifact: twin
Puml Server ID: 7SR13OCm30NGLUW0n7UsCS42eyH4zdUpFbNVwNtKQij3qjjo0ICs8kTPJiMLUuPuVGnYAFNff2qdWvrk_l9wIEXfws10t88wno-4gKQ2-az9xsLaRoy0
parent: semaphore; artifact: semaphore
Puml Server ID: HSV14SCm20J0Lk82BFxf1ikCfOn06ZZizfDVVhjRjphobFJnQi2ADv7pKwwEbaU6U9q6CPGwbVh8Xy5E7xvvFoNwPVjYGDo2bEC72b5URRgGeFvNqhMirF45
parent: message-channel; artifact: message-channel
Puml Server ID: NSZB3SCm203GLTe1RExTXX1akm9YyMdMRy-zFRtdCf8wkLmUCtF72y3nxcFbhAE2dIvBjknqAIof6nCTtlZ1TdAiOMrZ9hi5ACOFe1o1WnjDD6C1Jlg_NgvzbyeN
parent: poison-pill; artifact: poison-pill
Puml Server ID: JSZ14SCm20NHLf82BExfXiYCJGOX3NpYzkDZRllsgTwjTgcmnmciV145N-rGdFMkbEZJ8OxMvo2rkXWSzE4lRxka7huj1YGyQN3UGMjgpdkh6Gdwlrl5QAk6_G00
parent: aggregator-microservices; artifact: aggregator-service
Puml Server ID: JOov3SCm301NIGQGs7iRXYPa1g8ayB7NjuiKwGvtmBrbKC-Tq_hhY5Y-0HXUjKaS-Kbdepc2HrIQ2jBpma23BvvOTdPfeooCO1iEYlu0O6l63MDQKI6Rp-CKOWSE-ey_NzEqhjH-0m00
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'aggregator-microservices/etc/aggregator-service.urm.puml'
pumlid: JOov3SCm301NIGQGs7iRXYPa1g8ayB7NjuiKwGvtmBrbKC-Tq_hhY5Y-0HXUjKaS-Kbdepc2HrIQ2jBpma23BvvOTdPfeooCO1iEYlu0O6l63MDQKI6Rp-CKOWSE-ey_NzEqhjH-0m00
parent: aggregator-microservices; artifact: information-microservice
Puml Server ID: LSnB3i8m303Hgy016k-vZN5DQXGxaJ_jzUcMtKXFcgSOZTgvV3oEp1Kl0CUhTScZtXNiD2tPij5Ka54N9ZfyySHjvv1ksy9CTWjGZ3i0UtVkcDCt5V9vFquX3k0a4FjCLqoPzgUjNDig7Jy0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'aggregator-microservices/etc/information-microservice.urm.puml'
pumlid: LSnB3i8m303Hgy016k-vZN5DQXGxaJ_jzUcMtKXFcgSOZTgvV3oEp1Kl0CUhTScZtXNiD2tPij5Ka54N9ZfyySHjvv1ksy9CTWjGZ3i0UtVkcDCt5V9vFquX3k0a4FjCLqoPzgUjNDig7Jy0
parent: aggregator-microservices; artifact: inventory-microservice
Puml Server ID: LSpB3G8n303HLg20ZUzqOxnMrYXn8d-oedjovJRIIEyfIYrFJckFAsBw2y3mBbNYodSw6mqDrYWqEaZB6mCDFhZmEDcbwZ4nWaqTEleEm5gDAyQmemlPsCOIOWSE0j6riM7VlrVIUfdPsmy0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'aggregator-microservices/etc/inventory-microservice.urm.puml'
pumlid: LSpB3G8n303HLg20ZUzqOxnMrYXn8d-oedjovJRIIEyfIYrFJckFAsBw2y3mBbNYodSw6mqDrYWqEaZB6mCDFhZmEDcbwZ4nWaqTEleEm5gDAyQmemlPsCOIOWSE0j6riM7VlrVIUfdPsmy0
parent: bridge; artifact: bridge
Puml Server ID: BSR14SCm20J0Lf82BFxf1akCJ4R26ZZYzkE7zxLljJgoIVfu7S2A3v7pLRhYo3r3l9u6CPHwJjAH5uETllpZhKbejsqn86v1a-CExQwj2mdgqv8-oyev_W00
parent: servant; artifact: servant
Puml Server ID: DSkn4O0m20NGLNG0G-ys63cDbv0SV7HzRUnUy-QYkSOkONKwWU4haV6JZe8pjd2nt1MYIBatAZKU1XjTVFEoYvT3by60c3erzW_qdPiL9CY_KrXB8rfz0G00
parent: lazy-loading; artifact: lazy-loading
Puml Server ID: LSXB3W8X303Gg-W1e7jlqu66gIc5zED4JwzRTo_lpjeaEwN9xOpO_W0mlEhWEFD89sjBWpHgMnDOyi90WoU-i7Ho7besHf2fmqJ_0GG_xo8BE-i0YlONDMtMdLE-
parent: flyweight; artifact: flyweight
Puml Server ID: HSV94S8m3030Lg20M7-w4OvYAoCh7Xtnq3ty-Eq-MQlaJcdow17JNm26gpIEdkzqidffa4Qfrm2MN1XeSEADsqxEJRU94MJgCD1_W4C-YxZr08hwNqaRPUQGBm00
parent: mutex; artifact: mutex
Puml Server ID: 9SR13OCm30NGLSe0n7UsCS62LB69x6zWV2hrdTxKhFRS9Br_3c34GkHybxtXo3L3l9u6CPHwAhMUDuETldpnl4cqtUR1WBW5ASSlf0bvI53_A-bQHcf_0G00
parent: mediator; artifact: mediator
Puml Server ID: FSV14SCm20J0Lk82BFxf1akCJKOW3JhizfDNVhkRUktP9AE_Bc2kDr7mKqx5bKSkYJeSuYXr66dFXy517xvvRxBqz7qo8E6BZDSFPDAKCO84zP-IOMMczIy0
parent: page-object; artifact: page-object
Puml Server ID: JSV14OGW30NGLjO28FVj9iOCua1Wme-sxnxtzjvMJLeS6ju-9p3NbyZvoQNYZ3sMkWo36hACJhN5ms2dYszEXwvQB4q6r6rHv_K3JIwQndwfW1Jo_npUyupUNW00
parent: factory-kit; artifact: factory-kit
Puml Server ID: JST15i8m20N0g-W14lRU1YcsQ4BooCS-RwzBTpDNSscvQKQx7C1SDwBWi-w68--vD6Gur55bTBAM9uE3dlpcikcotSjaGCCNTLu_q8C58pxbPI25_Bzcz3gpjoy0
parent: property; artifact: property
Puml Server ID: FSV13OCm30NGLTe1YEziumOBKYMEPN-3s9wUUdlltRJst2Izlmx0OYLolihUSEGdGxnEXIXAdODQpul1Jby-UTaasgwBCI2kGOFZ1pAV9ewR1FMVaZwAvUWF
parent: dependency-injection; artifact: dependency-injection
Puml Server ID: RSdB3SCW303GLPe1mFTkunWhSGG6-PEesxS3zFQajubIpyPf_NL6B7y363xra3XpJsUZgS4QbUO0wVbWeC65DvR6BeUMXH5iwZ3GVu36YxMnqgU8NamXKu63_aPD6tNbw5y0
parent: layers; artifact: layers
Puml Server ID: BSR13OCm30NGLSe0n7UsCS62L8w9x6yGszD3t-bDpQhc9kdwEO0H2v7pNVQ68zSCyNeQn53gsQbftWns-lB5yoRHTfi70-8Mr3b-8UL7F4XG_otflOpi-W80
parent: producer-consumer; artifact: producer-consumer
Puml Server ID: PSjB3iCW303HgxG70Ezx6zTO2HKso9_a-c7VtUX9y-vA8nkdZTSPiVm3O7ZNeyUPttGscXgiKMaAz94t1XhyyCBIsFkXPM44cpe8-WvODbiIMzcdfspXe7-jQL9NodW0
parent: builder; artifact: builder
Puml Server ID: DSR94O0m2030LhG0mzzkC64KXs26GzlNZw_TcRLADagJwOWOlW8OFcNdE79B9wkN1ccKUdLWoGS33KwySMdalEioC89C7Jhw5zYIfNrIrFybhPUHNLu0
parent: specification; artifact: specification
Puml Server ID: LSX14i8m20NGg-W16lRU1YcsE0d9mCTUNxVkthoxkVJQjQBVJc3bWoZuQeVXh6UbXao7EfhCGTRhOd3Gcp-yxPfs-BOOqF2amVa3vLAnbmd3ffD2_gTLZBPgz2y0
parent: state; artifact: state
Puml Server ID: 9SRH3O0m20N0LNG0ox_RO2LQqz867hg-9jxNpKLpZLt2wdG2mrSYuoST1MTiuMAvAqIHSczKQZmCDhhuvcKNBuSkWm4nTMhiNyZ141BaVocifH6jlW00
parent: reader-writer-lock; artifact: reader-writer-lock
Puml Server ID: RSZB4S8m303HLg00MtUw4R8cCP5bZpwuVL80jttxx4gIZTFaSKOiVm4OxdhqEFETpaPJWpKgpG5TScEWmGU_M1fxFxGiZ61JXu5-1nXZOolR-gqYaoxWe3-xfeswSiWF
parent: interpreter; artifact: interpreter
Puml Server ID: JSf13eCm30NHgz034E-vZGaM62Kcih_BzQ6xxjv8yr6hBJT9RzC1Z5Y8dE-oAuvSCyJhPH13gLSdRNapsEdaBy-RXEus3mR4BQXpl21zVnykFmlgVvVqNaRszW00
parent: template-method; artifact: template-method
Puml Server ID: NSZ13SCW30NGLPe1mFTkuu0Lg6n0vZjPlpttzlIEFef6bN1zDM3jDv7paw-E5cTiyJ87P22NQTGr7WOxVVZcL6NtQwJ5WFZOPBn_88WjPKWoGPkL1EN_ShZb5QPV
parent: feature-toggle; artifact: feature-toggle
Puml Server ID: NSZ14G8X30NGLhG0oDrk8XjPd12OvCTjNy_UthpxiAPvIBhUJc37WyZvgdtWp6U6U5i6CTIs9WtDYy5ER_vmEIH6jx8P4BUWoV43lOIHBWMhTnKIjB-gwRFkdFe5
parent: business-delegate; artifact: business-delegate
Puml Server ID: POl13SCm3CHMQGU8zUysgYCuBcJ5a4x9-l6_Fu84tzsgvYxf-Zg06HyYvxkqZYE_6UBrD8YXr7DGrxmPxFJZYxTTeZVR9WFY5ZGu5j2wkad4wYgD8IIe_xQaZp9pw0C0
parent: naked-objects; artifact: naked-objects-integtests
Puml Server ID: LSmn4iCW30NHgoG70FMvZGmQ6ni48tt5ru_RT3kls7VJqgDAM7yTmF8FaV6TzuOZjd2nCXMYo6KEQZrk1XkT_ELKnTkkQJ4Wfaw3_GbIlgIckPrIu2Ge_vBQyziX3izX8wyO_GS0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'naked-objects/etc/naked-objects-integtests.urm.puml'
pumlid: LSmn4iCW30NHgoG70FMvZGmQ6ni48tt5ru_RT3kls7VJqgDAM7yTmF8FaV6TzuOZjd2nCXMYo6KEQZrk1XkT_ELKnTkkQJ4Wfaw3_GbIlgIckPrIu2Ge_vBQyziX3izX8wyO_GS0
parent: naked-objects; artifact: naked-objects-dom
Puml Server ID: LSZ94SCW3030Lf82G7zt8mkDZOC4eyDkF_dcjxFlhZIoSTfudH7BDm33fnuzpjpJsMXgi4QbAT17FXXeSE6DfR7tGyl223Pr4FGVGF73hSpzOWe73lgVqgRKDAahPNm1
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'naked-objects/etc/naked-objects-dom.urm.puml'
pumlid: LSZ94SCW3030Lf82G7zt8mkDZOC4eyDkF_dcjxFlhZIoSTfudH7BDm33fnuzpjpJsMXgi4QbAT17FXXeSE6DfR7tGyl223Pr4FGVGF73hSpzOWe73lgVqgRKDAahPNm1
parent: naked-objects; artifact: naked-objects-fixture
Puml Server ID: LSX15i8W30N0g-W187jlaq9igH1uoO_r-BfrDs_kJKkFAc7zTW3B7qJ6LzuRZjZ2nSfKY2ANEQZrk1XiTFARKnLlkwR5W9Ww3VOVIFabDStjb08dGVcVz6mVX4aE6td5w5y0
I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file 'naked-objects/etc/naked-objects-fixture.urm.puml'
pumlid: LSX15i8W30N0g-W187jlaq9igH1uoO_r-BfrDs_kJKkFAc7zTW3B7qJ6LzuRZjZ2nSfKY2ANEQZrk1XiTFARKnLlkwR5W9Ww3VOVIFabDStjb08dGVcVz6mVX4aE6td5w5y0
parent: model-view-controller; artifact: model-view-controller
Puml Server ID: ROl13SCm201NQGUm-NSRQgE42h258Lw_wR-_qvtkoTOaEwNBuuoOwmNWkEl1SUOx5taR5cHHsr1WoOs13X-yi7HQV5YP645k2nJN3Q2ZavIBQPVVwqFajXJjVwdfMcUgV040
parent: proxy; artifact: proxy
Puml Server ID: 9SR13OCm30NGLM00udktCS62eCI9x6yesrEfx_Jcehd69c5rEe3X7oBZE-q5HwpXOhahH95oRrHgt0msEldYPHClkow30J5rQko_qB3-VKYG_qjXBOrezGK0
parent: memento; artifact: memento
Puml Server ID: DSgn4OCm30NGLM00h3xR2AC3SvRiaxx2-g59zugtDgiz3qdlomNC-10vF-Lik7BF4A_388PIXrBh-J3OwUOlRuT4EssR38XRa7Ay81Lz_o11_RkaQvcf_GS0
parent: decorator; artifact: decorator
Puml Server ID: HSV14SCm20J0Lk82BFxf1YF6LaP26ZZizfDVVhjRC-bPDRs_Bc35cyZvAMV3bKU6kao36ehCGQtdms2d3z-yLursshuOKBUWmV43LPNfZEcaaFzA-YWhH_y2
parent: data-mapper; artifact: data-mapper
Puml Server ID: JShB3OGm303HLg20nFVjnYGM1CN6ycTfVtFSsnjfzY5jPgUqkLqHwXy0mxUU8wuyqidQ8q4IjJqCO-QBWGOtVh5qyd5AKOmW4mT6Nu2-ZiAekapH_hkcSTNa-GC0
parent: caching; artifact: caching
Puml Server ID: DSRB4OKm2030LhG0m_rrWyWaE0bc-6ZxpujxsbMKUXwSrfSMCVq7OFYKAj5oJsUZIuCr2bq3fEU3WGOdthWTx59rcnZ1fWu3_GqGKXEjm47VIzeeCqV_0m00
parent: reactor; artifact: reactor
Puml Server ID: DSR14OGm20NGLjO23FVj1f7Hx2Ga0nzjVxtuJc-f9YrtJM-V4vZn9NA-or5nvfQXBiEWXYAZKsrvCzZfnnUlkqOzR9qCg5jGvtX2hYmOJWfvNz9xcTdR7m00
parent: iterator; artifact: iterator
Puml Server ID: FSV13OGm30NHLg00uljsOu85HeaJsTzB-yjfBwCtgrfjUKXwMovWneV8-IcduiezGxmEWnXA7PsqvSDWfvk_l1qIUjes6H2teCxnWlGDOpW9wdzAUYypU_i1
parent: callback; artifact: callback
Puml Server ID: FSVB4S8m30N0Lg20M7UwUL4qYOciUFGXxSE9s-wp6sjjKgwF8tF6YyXnjxtdKMk5E5-MOjdu6jIrRYIStlXWsIJwRij4fhW53SGFn51TmIT9yZ-jVBHPGxy0
parent: repository; artifact: repository
Puml Server ID: JSV13OCm30NGLM00udktCS42eyI9xE-YRjyUUtjlLQij3qblomNCU14vF-LKNBbdYDTX44EfevEsV1ZiTFERjqD2Jzic0-8Mr3b-89SvGZ7yGuBwrvBUoypUlW00
parent: mute-idiom; artifact: mute-idiom
Puml Server ID: JSf13iCm20NHgxG7iDdtDjH62PKX5luarq-MtSsJvgtUHdR96AyTcEj357pLJR7dDvT4EnpYgEqmqf4NWuD-V7BfidJpCXcGy4N6wmcoX1Jj-lo2ziUQONMcZHi0
parent: prototype; artifact: prototype
Puml Server ID: HSV13OCm30NGLM00udktCS62eCInxE-YRj_UUdjlRLfx7fBUbmkmU14vF-Lik7BF4AzJ8OfIvw3Mys6mqyrltWw9Tkfc38XhqE3uWSmd9Zuc9AZ_bVHHB4V_0W00
parent: step-builder; artifact: step-builder
Puml Server ID: LOZ93SCm3C1MQGQmzUysYYqaAcJ5q96i7t_x8KXkh4soKvfypeZfNm33fnuSP-xfPEtI88tQhW4i-M2WmGzlB9sS3oqJ8yZKOQ0lWOLPzcJfAoZQtwXfeyuSyW80
parent: double-checked-locking; artifact: double-checked-locking
Puml Server ID: TSdH4SCW203GLTe1bFzkGv1J6qGFeLc_MI1_x-wzkv94uJ1vDVUrFm26LwxTMnonsMYgitgcEQ1BNEXeyCKVfiAxLqqBtTbqmy1z0ygCGpXHOpgv99bqTgt0JW-LmqPUCUGF

View File

@ -0,0 +1,67 @@
#
# The MIT License
# Copyright (c) 2014 Ilkka Seppälä
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
import requests, glob, re, os
# taken from here: http://stackoverflow.com/a/13641746
def replace(file, pattern, subst):
# Read contents from file as a single string
file_handle = open(file, 'r')
file_string = file_handle.read()
file_handle.close()
# Use RE package to allow for replacement (also allowing for (multiline) REGEX)
file_string = (re.sub(pattern, subst, file_string))
# Write contents to file.
# Using mode 'w' truncates the file.
file_handle = open(file, 'w')
file_handle.write(file_string)
file_handle.close()
# list of all puml files
fileList = glob.glob('*/etc/*.puml')
for puml in fileList:
pathSplit = puml.split("/")
# parent folder
parent = pathSplit[0]
# individual artifact/project name
artifact = pathSplit[2].replace(".urm.puml", "")
print "parent: " + parent + "; artifact: " + artifact
# do a POST to the official plantuml hosting site with a little trick "!includeurl" and raw github content
data = {
'text': "!includeurl https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/" + puml
}
r = requests.post('http://plantuml.com/plantuml/uml', data=data)
pumlId = r.url.replace("http://plantuml.com/plantuml/uml/", "")
# the only thing needed to get a png/svg/ascii from the server back
print "Puml Server ID: " + pumlId
# add the id so jekyll/liquid can use it
if (parent == artifact):
replace("./" + parent + "/README.md", "categories:", "pumlid: {}\\ncategories:".format(pumlId))
else:
print "I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file '" + puml + "'\npumlid: {}".format(pumlId)

View File

@ -3,6 +3,7 @@ layout: pattern
title: Abstract Document
folder: abstract-document
permalink: /patterns/abstract-document/
pumlid: PSjB3eCm34NHhPG599vtDyQn85L-ifzX-p3lxEf8Twj3MXGDQvyJMFubChxpKN767gucSq07iinEjSNDOACVNvoAUZr6MWoe3QVE_WRnxZ0Mf38b-hkIGlurX_MyehS7
categories: Structural
tags:
- Java

View File

@ -0,0 +1,59 @@
@startuml
package com.iluwatar.abstractdocument.domain {
class Part {
+ Part(properties : Map<String, Object>)
}
interface HasPrice {
+ PROPERTY : String {static}
+ getPrice() : Optional<Number>
}
interface HasParts {
+ PROPERTY : String {static}
+ getParts() : Stream<Part>
}
class Car {
+ Car(properties : Map<String, Object>)
}
interface HasType {
+ PROPERTY : String {static}
+ getType() : Optional<String>
}
interface HasModel {
+ PROPERTY : String {static}
+ getModel() : Optional<String>
}
}
package com.iluwatar.abstractdocument {
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class AbstractDocument {
- properties : Map<String, Object>
# AbstractDocument(properties : Map<String, Object>)
+ children(key : String, constructor : Function<Map<String, Object>, T>) : Stream<T>
+ get(key : String) : Object
+ put(key : String, value : Object)
+ toString() : String
}
interface Document {
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
+ get(String) : Object {abstract}
+ put(String, Object) {abstract}
}
}
AbstractDocument --+ Map
Part ..|> HasType
Part ..|> HasModel
Part ..|> HasPrice
Part --|> AbstractDocument
AbstractDocument ..|> Document
HasPrice --|> Document
HasParts --|> Document
Car ..|> HasModel
Car ..|> HasPrice
Car ..|> HasParts
Car --|> AbstractDocument
HasType --|> Document
HasModel --|> Document
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>abstract-document</artifactId>
<dependencies>

View File

@ -3,8 +3,9 @@ layout: pattern
title: Abstract Factory
folder: abstract-factory
permalink: /patterns/abstract-factory/
pumlid: PSZB3OD034NHLa81Czwd6sCC39gVxEUWT1_ssLmTtQLqgR5fM7sTmFGtaV6TZu8prd0r6HtQaMKqAZLk1XjT_E6qgPUZfyc0MdTgx0-8LuUn8ErFXdr98NypXxKyezKV
categories: Creational
tags:
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
@ -30,6 +31,8 @@ Use the Abstract Factory pattern when
## Real world examples
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
* [javax.xml.transform.TransformerFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/transform/TransformerFactory.html#newInstance--)
* [javax.xml.xpath.XPathFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/xpath/XPathFactory.html#newInstance--)
## Credits

View File

@ -0,0 +1,88 @@
@startuml
package com.iluwatar.abstractfactory {
class App {
- army : Army
- castle : Castle
- king : King
+ App()
+ createKingdom(factory : KingdomFactory)
+ getArmy() : Army
~ getArmy(factory : KingdomFactory) : Army
+ getCastle() : Castle
~ getCastle(factory : KingdomFactory) : Castle
+ getKing() : King
~ getKing(factory : KingdomFactory) : King
+ main(args : String[]) {static}
- setArmy(army : Army)
- setCastle(castle : Castle)
- setKing(king : King)
}
class OrcKingdomFactory {
+ OrcKingdomFactory()
+ createArmy() : Army
+ createCastle() : Castle
+ createKing() : King
}
class ElfCastle {
~ DESCRIPTION : String {static}
+ ElfCastle()
+ getDescription() : String
}
class OrcCastle {
~ DESCRIPTION : String {static}
+ OrcCastle()
+ getDescription() : String
}
interface KingdomFactory {
+ createArmy() : Army {abstract}
+ createCastle() : Castle {abstract}
+ createKing() : King {abstract}
}
class ElfKing {
~ DESCRIPTION : String {static}
+ ElfKing()
+ getDescription() : String
}
class ElfArmy {
~ DESCRIPTION : String {static}
+ ElfArmy()
+ getDescription() : String
}
interface Castle {
+ getDescription() : String {abstract}
}
interface Army {
+ getDescription() : String {abstract}
}
class OrcKing {
~ DESCRIPTION : String {static}
+ OrcKing()
+ getDescription() : String
}
class OrcArmy {
~ DESCRIPTION : String {static}
+ OrcArmy()
+ getDescription() : String
}
interface King {
+ getDescription() : String {abstract}
}
class ElfKingdomFactory {
+ ElfKingdomFactory()
+ createArmy() : Army
+ createCastle() : Castle
+ createKing() : King
}
}
App --> "-castle" Castle
App --> "-king" King
App --> "-army" Army
OrcKingdomFactory ..|> KingdomFactory
ElfCastle ..|> Castle
OrcCastle ..|> Castle
ElfKing ..|> King
ElfArmy ..|> Army
OrcKing ..|> King
OrcArmy ..|> Army
ElfKingdomFactory ..|> KingdomFactory
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>abstract-factory</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Adapter
folder: adapter
permalink: /patterns/adapter/
pumlid: DSR14S8m30J0Lg20M7-wEMnDOiPMFDA9j0yyUEtUkzMHJTF7xI1NF4GSLzaxZtncgDVJgCPIpobzv0N2vOKtjgRHTziMI7KBcOXl10thfxB-Nz9dMJd71m00
categories: Structural
tags:
- Java
@ -30,6 +31,10 @@ Use the Adapter pattern when
## Real world examples
* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)
* [java.util.Collections#list()](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#list-java.util.Enumeration-)
* [java.util.Collections#enumeration()](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#enumeration-java.util.Collection-)
* [javax.xml.bind.annotation.adapters.XMLAdapter](http://docs.oracle.com/javase/8/docs/api/javax/xml/bind/annotation/adapters/XmlAdapter.html#marshal-BoundType-)
## Credits

View File

@ -0,0 +1,35 @@
@startuml
package com.iluwatar.adapter {
interface BattleShip {
+ fire() {abstract}
+ move() {abstract}
}
class BattleFishingBoat {
- boat : FishingBoat
+ BattleFishingBoat()
+ fire()
+ move()
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Captain {
- battleship : BattleShip
+ Captain()
+ Captain(battleship : BattleShip)
+ fire()
+ move()
+ setBattleship(battleship : BattleShip)
}
class FishingBoat {
+ FishingBoat()
+ fish()
+ sail()
}
}
BattleFishingBoat --> "-boat" FishingBoat
Captain --> "-battleship" BattleShip
BattleFishingBoat ..|> BattleShip
Captain ..|> BattleShip
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>adapter</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Aggregator Microservices
folder: aggregator-microservices
permalink: /patterns/aggregator-microservices/
pumlid: JOov3SCm301NIGQGs7iRXYPa1g8ayB7NjuiKwGvtmBrbKC-Tq_hhY5Y-0HXUjKaS-Kbdepc2HrIQ2jBpma23BvvOTdPfeooCO1iEYlu0O6l63MDQKI6Rp-CKOWSE-ey_NzEqhjH-0m00
categories: Architectural
tags:
- Java

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -0,0 +1,41 @@
@startuml
package com.iluwatar.aggregator.microservices {
class ProductInventoryClientImpl {
+ ProductInventoryClientImpl()
+ getProductInventories() : int
}
class App {
+ App()
+ main(args : String[]) {static}
}
interface ProductInventoryClient {
+ getProductInventories() : int {abstract}
}
class Product {
- productInventories : int
- title : String
+ Product()
+ getProductInventories() : int
+ getTitle() : String
+ setProductInventories(productInventories : int)
+ setTitle(title : String)
}
class Aggregator {
- informationClient : ProductInformationClient
- inventoryClient : ProductInventoryClient
+ Aggregator()
+ getProduct() : Product
}
class ProductInformationClientImpl {
+ ProductInformationClientImpl()
+ getProductTitle() : String
}
interface ProductInformationClient {
+ getProductTitle() : String {abstract}
}
}
Aggregator --> "-inventoryClient" ProductInventoryClient
Aggregator --> "-informationClient" ProductInformationClient
ProductInventoryClientImpl ..|> ProductInventoryClient
ProductInformationClientImpl ..|> ProductInformationClient
@enduml

View File

@ -0,0 +1,12 @@
@startuml
package com.iluwatar.information.microservice {
class InformationApplication {
+ InformationApplication()
+ main(args : String[]) {static}
}
class InformationController {
+ InformationController()
+ getProductTitle() : String
}
}
@enduml

View File

@ -0,0 +1,12 @@
@startuml
package com.iluwatar.inventory.microservice {
class InventoryController {
+ InventoryController()
+ getProductInventories() : int
}
class InventoryApplication {
+ InventoryApplication()
+ main(args : String[]) {static}
}
}
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,15 +29,35 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aggregator-microservices</artifactId>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>com.github.markusmo3.urm</groupId>
<artifactId>urm-maven-plugin</artifactId>
<version>${urm.version}</version>
<configuration combine.self="override">
<outputDirectory>${project.basedir}/../etc</outputDirectory>
<packages>
<param>com.iluwatar</param>
</packages>
<skipForProjects>
<!-- skip for parent project -->
<param>aggregator-microservices</param>
</skipForProjects>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>information-microservice</module>
<module>aggregator-service</module>
<module>inventory-microservice</module>
</modules>
</project>
</project>

View File

@ -3,6 +3,7 @@ layout: pattern
title: API Gateway
folder: api-gateway
permalink: /patterns/api-gateway/
pumlid: JSox3SCm303HLP819FRUXg49cO542_nOyFPncUvUSszHwhbpMdyT4TCt0CDLcyIHdtGsEZLOez8vG7ek33JuueLbPvUcPM84cpeCz2S0fvI6mGjluA1_b-Tt2N5D6tNcw3y0
categories: Architectural
tags:
- Java

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway-service</artifactId>

View File

@ -0,0 +1,48 @@
@startuml
package com.iluwatar.api.gateway {
class App {
+ App()
+ main(args : String[]) {static}
}
class PriceClientImpl {
+ PriceClientImpl()
+ getPrice() : String
}
class ImageClientImpl {
+ ImageClientImpl()
+ getImagePath() : String
}
class MobileProduct {
- price : String
+ MobileProduct()
+ getPrice() : String
+ setPrice(price : String)
}
interface ImageClient {
+ getImagePath() : String {abstract}
}
class ApiGateway {
- imageClient : ImageClient
- priceClient : PriceClient
+ ApiGateway()
+ getProductDesktop() : DesktopProduct
+ getProductMobile() : MobileProduct
}
class DesktopProduct {
- imagePath : String
- price : String
+ DesktopProduct()
+ getImagePath() : String
+ getPrice() : String
+ setImagePath(imagePath : String)
+ setPrice(price : String)
}
interface PriceClient {
+ getPrice() : String {abstract}
}
}
ApiGateway --> "-imageClient" ImageClient
ApiGateway --> "-priceClient" PriceClient
PriceClientImpl ..|> PriceClient
ImageClientImpl ..|> ImageClient
@enduml

View File

@ -0,0 +1,12 @@
@startuml
package com.iluwatar.image.microservice {
class ImageApplication {
+ ImageApplication()
+ main(args : String[]) {static}
}
class ImageController {
+ ImageController()
+ getImagePath() : String
}
}
@enduml

View File

@ -0,0 +1,12 @@
@startuml
package com.iluwatar.price.microservice {
class PriceApplication {
+ PriceApplication()
+ main(args : String[]) {static}
}
class PriceController {
+ PriceController()
+ getPrice() : String
}
}
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,15 +29,35 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway</artifactId>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>com.github.markusmo3.urm</groupId>
<artifactId>urm-maven-plugin</artifactId>
<version>${urm.version}</version>
<configuration combine.self="override">
<outputDirectory>${project.basedir}/../etc</outputDirectory>
<packages>
<param>com.iluwatar</param>
</packages>
<skipForProjects>
<!-- skip for parent project -->
<param>api-gateway</param>
</skipForProjects>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>image-microservice</module>
<module>price-microservice</module>
<module>api-gateway-service</module>
</modules>
</project>
</project>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,11 +3,13 @@ layout: pattern
title: Async Method Invocation
folder: async-method-invocation
permalink: /patterns/async-method-invocation/
pumlid: TSdB3SCW303GLTe1mFTkunWhk0A3_4dKxTi5UdlIUuhIoCPfuz4Zjhy03EzwIlGyqjbeQR16fJL1HjuOQF362qjZbrFBnWWsTPZeFm3wHwbCZhvQ4RqMOSXIuA1_LzDctJd75m00
categories: Concurrency
tags:
- Java
- Difficulty-Intermediate
- Functional
- Reactive
---
## Intent

View File

@ -0,0 +1,50 @@
@startuml
package com.iluwatar.async.method.invocation {
class App {
+ App()
- callback(name : String) : AsyncCallback<T> {static}
- lazyval(value : T, delayMillis : long) : Callable<T> {static}
- log(msg : String) {static}
+ main(args : String[]) {static}
}
interface AsyncResult<T> {
+ await() {abstract}
+ getValue() : T {abstract}
+ isCompleted() : boolean {abstract}
}
interface AsyncExecutor {
+ endProcess(AsyncResult<T>) : T {abstract}
+ startProcess(Callable<T>) : AsyncResult<T> {abstract}
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
}
class ThreadAsyncExecutor {
- idx : AtomicInteger
+ ThreadAsyncExecutor()
+ endProcess(asyncResult : AsyncResult<T>) : T
+ startProcess(task : Callable<T>) : AsyncResult<T>
+ startProcess(task : Callable<T>, callback : AsyncCallback<T>) : AsyncResult<T>
}
interface AsyncCallback<T> {
+ onComplete(T, Optional<Exception>) {abstract}
}
-class CompletableResult<T> {
~ COMPLETED : int {static}
~ FAILED : int {static}
~ RUNNING : int {static}
~ callback : Optional<AsyncCallback<T>>
~ exception : Exception
~ lock : Object
~ state : int
~ value : T
~ CompletableResult<T>(callback : AsyncCallback<T>)
+ await()
+ getValue() : T
+ isCompleted() : boolean
~ setException(exception : Exception)
~ setValue(value : T)
}
}
CompletableResult ..+ ThreadAsyncExecutor
ThreadAsyncExecutor ..|> AsyncExecutor
CompletableResult ..|> AsyncResult
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>async-method-invocation</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Bridge
folder: bridge
permalink: /patterns/bridge/
pumlid: BSR14SCm20J0Lf82BFxf1akCJ4R26ZZYzkE7zxLljJgoIVfu7S2A3v7pLRhYo3r3l9u6CPHwJjAH5uETllpZhKbejsqn86v1a-CExQwj2mdgqv8-oyev_W00
categories: Structural
tags:
- Java

View File

@ -0,0 +1,89 @@
@startuml
package com.iluwatar.bridge {
class FlyingMagicWeapon {
+ FlyingMagicWeapon(imp : FlyingMagicWeaponImpl)
+ fly()
+ getImp() : FlyingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
class Stormbringer {
+ Stormbringer()
+ eatSoulImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
abstract class FlyingMagicWeaponImpl {
+ FlyingMagicWeaponImpl()
+ flyImp() {abstract}
}
class SoulEatingMagicWeapon {
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
+ eatSoul()
+ getImp() : SoulEatingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
abstract class MagicWeaponImpl {
+ MagicWeaponImpl()
+ swingImp() {abstract}
+ unwieldImp() {abstract}
+ wieldImp() {abstract}
}
abstract class SoulEatingMagicWeaponImpl {
+ SoulEatingMagicWeaponImpl()
+ eatSoulImp() {abstract}
}
class Excalibur {
+ Excalibur()
+ blindImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class Mjollnir {
+ Mjollnir()
+ flyImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class MagicWeapon {
# imp : MagicWeaponImpl
+ MagicWeapon(imp : MagicWeaponImpl)
+ getImp() : MagicWeaponImpl
+ swing() {abstract}
+ unwield() {abstract}
+ wield() {abstract}
}
abstract class BlindingMagicWeaponImpl {
+ BlindingMagicWeaponImpl()
+ blindImp() {abstract}
}
class BlindingMagicWeapon {
+ BlindingMagicWeapon(imp : BlindingMagicWeaponImpl)
+ blind()
+ getImp() : BlindingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
}
MagicWeapon --> "-imp" MagicWeaponImpl
FlyingMagicWeapon --|> MagicWeapon
Stormbringer --|> SoulEatingMagicWeaponImpl
FlyingMagicWeaponImpl --|> MagicWeaponImpl
SoulEatingMagicWeapon --|> MagicWeapon
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
Excalibur --|> BlindingMagicWeaponImpl
Mjollnir --|> FlyingMagicWeaponImpl
BlindingMagicWeaponImpl --|> MagicWeaponImpl
BlindingMagicWeapon --|> MagicWeapon
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>bridge</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Builder
folder: builder
permalink: /patterns/builder/
pumlid: DSR94O0m2030LhG0mzzkC64KXs26GzlNZw_TcRLADagJwOWOlW8OFcNdE79B9wkN1ccKUdLWoGS33KwySMdalEioC89C7Jhw5zYIfNrIrFybhPUHNLu0
categories: Creational
tags:
- Java
@ -26,6 +27,9 @@ Use the Builder pattern when
## Real world examples
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
* [java.nio.ByteBuffer](http://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html#put-byte-) as well as similar buffers such as FloatBuffer, IntBuffer and so on.
* [java.lang.StringBuffer](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html#append-boolean-)
* All implementations of [java.lang.Appendable](http://docs.oracle.com/javase/8/docs/api/java/lang/Appendable.html)
* [Apache Camel builders](https://github.com/apache/camel/tree/0e195428ee04531be27a0b659005e3aa8d159d23/camel-core/src/main/java/org/apache/camel/builder)
## Credits

View File

@ -0,0 +1,100 @@
@startuml
package com.iluwatar.builder {
class Builder {
- armor : Armor
- hairColor : HairColor
- hairType : HairType
- name : String
- profession : Profession
- weapon : Weapon
+ Builder(profession : Profession, name : String)
+ build() : Hero
+ withArmor(armor : Armor) : Builder
+ withHairColor(hairColor : HairColor) : Builder
+ withHairType(hairType : HairType) : Builder
+ withWeapon(weapon : Weapon) : Builder
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Hero {
- armor : Armor
- hairColor : HairColor
- hairType : HairType
- name : String
- profession : Profession
- weapon : Weapon
- Hero(builder : Builder)
+ getArmor() : Armor
+ getHairColor() : HairColor
+ getHairType() : HairType
+ getName() : String
+ getProfession() : Profession
+ getWeapon() : Weapon
+ toString() : String
}
enum Weapon {
+ AXE {static}
+ BOW {static}
+ DAGGER {static}
+ SWORD {static}
+ WARHAMMER {static}
+ toString() : String
+ valueOf(name : String) : Weapon {static}
+ values() : Weapon[] {static}
}
enum HairColor {
+ BLACK {static}
+ BLOND {static}
+ BROWN {static}
+ RED {static}
+ WHITE {static}
+ toString() : String
+ valueOf(name : String) : HairColor {static}
+ values() : HairColor[] {static}
}
enum Profession {
+ MAGE {static}
+ PRIEST {static}
+ THIEF {static}
+ WARRIOR {static}
+ toString() : String
+ valueOf(name : String) : Profession {static}
+ values() : Profession[] {static}
}
enum Armor {
+ CHAIN_MAIL {static}
+ CLOTHES {static}
+ LEATHER {static}
+ PLATE_MAIL {static}
- title : String
+ toString() : String
+ valueOf(name : String) : Armor {static}
+ values() : Armor[] {static}
}
enum HairType {
+ BALD {static}
+ CURLY {static}
+ LONG_CURLY {static}
+ LONG_STRAIGHT {static}
+ SHORT {static}
- title : String
+ toString() : String
+ valueOf(name : String) : HairType {static}
+ values() : HairType[] {static}
}
}
Hero --> "-profession" Profession
Builder ..+ Hero
Hero --> "-armor" Armor
App --+ Hero
Builder --> "-weapon" Weapon
Builder --> "-hairColor" HairColor
Builder --> "-hairType" HairType
Hero --> "-hairColor" HairColor
Builder --> "-profession" Profession
Hero --> "-weapon" Weapon
Hero --> "-hairType" HairType
Builder --> "-armor" Armor
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>builder</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Business Delegate
folder: business-delegate
permalink: /patterns/business-delegate/
pumlid: POl13SCm3CHMQGU8zUysgYCuBcJ5a4x9-l6_Fu84tzsgvYxf-Zg06HyYvxkqZYE_6UBrD8YXr7DGrxmPxFJZYxTTeZVR9WFY5ZGu5j2wkad4wYgD8IIe_xQaZp9pw0C0
categories: Business Tier
tags:
- Java

View File

@ -0,0 +1,55 @@
@startuml
package com.iluwatar.business.delegate {
class EjbService {
+ EjbService()
+ doProcessing()
}
class BusinessLookup {
- ejbService : EjbService
- jmsService : JmsService
+ BusinessLookup()
+ getBusinessService(serviceType : ServiceType) : BusinessService
+ setEjbService(ejbService : EjbService)
+ setJmsService(jmsService : JmsService)
}
class App {
+ App()
+ main(args : String[]) {static}
}
interface BusinessService {
+ doProcessing() {abstract}
}
class Client {
- businessDelegate : BusinessDelegate
+ Client(businessDelegate : BusinessDelegate)
+ doTask()
}
class BusinessDelegate {
- businessService : BusinessService
- lookupService : BusinessLookup
- serviceType : ServiceType
+ BusinessDelegate()
+ doTask()
+ setLookupService(businessLookup : BusinessLookup)
+ setServiceType(serviceType : ServiceType)
}
class JmsService {
+ JmsService()
+ doProcessing()
}
enum ServiceType {
+ EJB {static}
+ JMS {static}
+ valueOf(name : String) : ServiceType {static}
+ values() : ServiceType[] {static}
}
}
BusinessDelegate --> "-serviceType" ServiceType
BusinessLookup --> "-ejbService" EjbService
Client --> "-businessDelegate" BusinessDelegate
BusinessDelegate --> "-businessService" BusinessService
BusinessDelegate --> "-lookupService" BusinessLookup
BusinessLookup --> "-jmsService" JmsService
EjbService ..|> BusinessService
JmsService ..|> BusinessService
@enduml

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>business-delegate</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Caching
folder: caching
permalink: /patterns/caching/
pumlid: DSRB4OKm2030LhG0m_rrWyWaE0bc-6ZxpujxsbMKUXwSrfSMCVq7OFYKAj5oJsUZIuCr2bq3fEU3WGOdthWTx59rcnZ1fWu3_GqGKXEjm47VIzeeCqV_0m00
categories: Other
tags:
- Java

View File

@ -0,0 +1,100 @@
@startuml
package com.iluwatar.caching {
class App {
+ App()
+ main(args : String[]) {static}
+ useReadAndWriteThroughStrategy()
+ useReadThroughAndWriteAroundStrategy()
+ useReadThroughAndWriteBehindStrategy()
}
~class Node {
~ next : Node
~ previous : Node
~ userAccount : UserAccount
~ userId : String
+ Node(this$0 : String, userId : UserAccount)
}
class CacheStore {
~ cache : LruCache {static}
- CacheStore()
+ clearCache() {static}
+ flushCache() {static}
+ initCapacity(capacity : int) {static}
+ print() : String {static}
+ readThrough(userId : String) : UserAccount {static}
+ readThroughWithWriteBackPolicy(userId : String) : UserAccount {static}
+ writeAround(userAccount : UserAccount) {static}
+ writeBehind(userAccount : UserAccount) {static}
+ writeThrough(userAccount : UserAccount) {static}
}
class AppManager {
- cachingPolicy : CachingPolicy {static}
- AppManager()
+ find(userId : String) : UserAccount {static}
+ initCacheCapacity(capacity : int) {static}
+ initCachingPolicy(policy : CachingPolicy) {static}
+ initDb(useMongoDb : boolean) {static}
+ printCacheContent() : String {static}
+ save(userAccount : UserAccount) {static}
}
class UserAccount {
- additionalInfo : String
- userId : String
- userName : String
+ UserAccount(userId : String, userName : String, additionalInfo : String)
+ getAdditionalInfo() : String
+ getUserId() : String
+ getUserName() : String
+ setAdditionalInfo(additionalInfo : String)
+ setUserId(userId : String)
+ setUserName(userName : String)
+ toString() : String
}
class LruCache {
~ cache : Map<String, Node>
~ capacity : int
~ end : Node
~ head : Node
+ LruCache(capacity : int)
+ clear()
+ contains(userId : String) : boolean
+ get(userId : String) : UserAccount
+ getCacheDataInListForm() : List<UserAccount>
+ getLruData() : UserAccount
+ invalidate(userId : String)
+ isFull() : boolean
+ remove(node : Node)
+ set(userId : String, userAccount : UserAccount)
+ setCapacity(newCapacity : int)
+ setHead(node : Node)
}
class DbManager {
- db : MongoDatabase {static}
- mongoClient : MongoClient {static}
- useMongoDB : boolean {static}
- virtualDB : Map<String, UserAccount> {static}
- DbManager()
+ connect() {static}
+ createVirtualDb() {static}
+ readFromDb(userId : String) : UserAccount {static}
+ updateDb(userAccount : UserAccount) {static}
+ upsertDb(userAccount : UserAccount) {static}
+ writeToDb(userAccount : UserAccount) {static}
}
enum CachingPolicy {
+ AROUND {static}
+ BEHIND {static}
+ THROUGH {static}
- policy : String
+ getPolicy() : String
+ valueOf(name : String) : CachingPolicy {static}
+ values() : CachingPolicy[] {static}
}
}
Node --+ LruCache
LruCache --> "-head" Node
Node --> "-previous" Node
AppManager --> "-cachingPolicy" CachingPolicy
Node --> "-userAccount" UserAccount
CacheStore --> "-cache" LruCache
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>caching</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Callback
folder: callback
permalink: /patterns/callback/
pumlid: FSVB4S8m30N0Lg20M7UwUL4qYOciUFGXxSE9s-wp6sjjKgwF8tF6YyXnjxtdKMk5E5-MOjdu6jIrRYIStlXWsIJwRij4fhW53SGFn51TmIT9yZ-jVBHPGxy0
categories: Other
tags:
- Java

View File

@ -0,0 +1,25 @@
@startuml
package com.iluwatar.callback {
interface Callback {
+ call() {abstract}
}
abstract class Task {
+ Task()
+ execute() {abstract}
+ executeWith(callback : Callback)
}
class App {
+ App()
+ main(args : String[]) {static}
}
class SimpleTask {
+ SimpleTask()
+ execute()
}
class LambdasApp {
+ LambdasApp()
+ main(args : String[]) {static}
}
}
SimpleTask --|> Task
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>callback</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Chain of responsibility
folder: chain
permalink: /patterns/chain/
pumlid: 9SR13SCm20NGLTe1OkxTXX0KKzd4Wa-pVYlrdTxJN4OTMZ4U7LZv8Wg-ssdejLTgoELGHvDhaesw6HpqvWzlXwQTlYq6D3nfSlv2qjcS5F9VgvXjrHnV
categories: Behavioral
tags:
- Java
@ -28,6 +29,7 @@ Use Chain of Responsibility when
* [java.util.logging.Logger#log()](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html#log%28java.util.logging.Level,%20java.lang.String%29)
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)
* [javax.servlet.Filter#doFilter()](http://docs.oracle.com/javaee/7/api/javax/servlet/Filter.html#doFilter-javax.servlet.ServletRequest-javax.servlet.ServletResponse-javax.servlet.FilterChain-)
## Credits

60
chain/etc/chain.urm.puml Normal file
View File

@ -0,0 +1,60 @@
@startuml
package com.iluwatar.chain {
class OrcSoldier {
+ OrcSoldier(handler : RequestHandler)
+ handleRequest(req : Request)
+ toString() : String
}
class OrcCommander {
+ OrcCommander(handler : RequestHandler)
+ handleRequest(req : Request)
+ toString() : String
}
class OrcKing {
~ chain : RequestHandler
+ OrcKing()
- buildChain()
+ makeRequest(req : Request)
}
class Request {
- handled : boolean
- requestDescription : String
- requestType : RequestType
+ Request(requestType : RequestType, requestDescription : String)
+ getRequestDescription() : String
+ getRequestType() : RequestType
+ isHandled() : boolean
+ markHandled()
+ toString() : String
}
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class RequestHandler {
- next : RequestHandler
+ RequestHandler(next : RequestHandler)
+ handleRequest(req : Request)
# printHandling(req : Request)
+ toString() : String {abstract}
}
class OrcOfficer {
+ OrcOfficer(handler : RequestHandler)
+ handleRequest(req : Request)
+ toString() : String
}
enum RequestType {
+ COLLECT_TAX {static}
+ DEFEND_CASTLE {static}
+ TORTURE_PRISONER {static}
+ valueOf(name : String) : RequestType {static}
+ values() : RequestType[] {static}
}
}
RequestHandler --> "-next" RequestHandler
Request --> "-requestType" RequestType
OrcKing --> "-chain" RequestHandler
OrcSoldier --|> RequestHandler
OrcCommander --|> RequestHandler
OrcOfficer --|> RequestHandler
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>chain</artifactId>
<dependencies>

View File

@ -3,11 +3,13 @@ layout: pattern
title: Command
folder: command
permalink: /patterns/command/
pumlid: DSgn4OCm30NGLM00h3xR25i7vYpXaxx2-g59zugtTgiZcwIFvGHcV8YSdt9qdBbdYDVR88PIRwK-yc6mqyLVtff4FsoR38XRa7Aye3SgMoD1_RkaQvcfumS0
categories: Behavioral
tags:
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
- Functional
---
## Also known as
@ -39,6 +41,7 @@ Use the Command pattern when you want to
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
* [Netflix Hystrix](https://github.com/Netflix/Hystrix/wiki)
* [javax.swing.Action](http://docs.oracle.com/javase/8/docs/api/javax/swing/Action.html)
## Credits

View File

@ -0,0 +1,84 @@
@startuml
package com.iluwatar.command {
class InvisibilitySpell {
- target : Target
+ InvisibilitySpell()
+ execute(target : Target)
+ redo()
+ toString() : String
+ undo()
}
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class Command {
+ Command()
+ execute(Target) {abstract}
+ redo() {abstract}
+ toString() : String {abstract}
+ undo() {abstract}
}
class Goblin {
+ Goblin()
+ toString() : String
}
abstract class Target {
- size : Size
- visibility : Visibility
+ Target()
+ getSize() : Size
+ getVisibility() : Visibility
+ printStatus()
+ setSize(size : Size)
+ setVisibility(visibility : Visibility)
+ toString() : String {abstract}
}
class Wizard {
- redoStack : Deque<Command>
- undoStack : Deque<Command>
+ Wizard()
+ castSpell(command : Command, target : Target)
+ redoLastSpell()
+ toString() : String
+ undoLastSpell()
}
class ShrinkSpell {
- oldSize : Size
- target : Target
+ ShrinkSpell()
+ execute(target : Target)
+ redo()
+ toString() : String
+ undo()
}
enum Size {
+ LARGE {static}
+ NORMAL {static}
+ SMALL {static}
+ UNDEFINED {static}
- title : String
+ toString() : String
+ valueOf(name : String) : Size {static}
+ values() : Size[] {static}
}
enum Visibility {
+ INVISIBLE {static}
+ UNDEFINED {static}
+ VISIBLE {static}
- title : String
+ toString() : String
+ valueOf(name : String) : Visibility {static}
+ values() : Visibility[] {static}
}
}
Target --> "-size" Size
Wizard --> "-undoStack" Command
ShrinkSpell --> "-oldSize" Size
InvisibilitySpell --> "-target" Target
ShrinkSpell --> "-target" Target
Target --> "-visibility" Visibility
InvisibilitySpell --|> Command
Goblin --|> Target
ShrinkSpell --|> Command
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>command</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Composite
folder: composite
permalink: /patterns/composite/
pumlid: HSf13eCm30NHgy01YFUzZGaM62LEP7-NwvTTT_EaMTLgoqFIst81Cpv4payv5LVk6U9r6CHGwkYaBHy6EztyvUsGqDEsoO2u1NMED-WTvmY5aA3-LT9xcTdR3m00
categories: Structural
tags:
- Java

View File

@ -0,0 +1,42 @@
@startuml
package com.iluwatar.composite {
class Word {
+ Word(letters : List<Letter>)
# printThisAfter()
# printThisBefore()
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Messenger {
+ Messenger()
~ messageFromElves() : LetterComposite
~ messageFromOrcs() : LetterComposite
}
class Letter {
- c : char
+ Letter(c : char)
# printThisAfter()
# printThisBefore()
}
class Sentence {
+ Sentence(words : List<Word>)
# printThisAfter()
# printThisBefore()
}
abstract class LetterComposite {
- children : List<LetterComposite>
+ LetterComposite()
+ add(letter : LetterComposite)
+ count() : int
+ print()
# printThisAfter() {abstract}
# printThisBefore() {abstract}
}
}
LetterComposite --> "-children" LetterComposite
Word --|> LetterComposite
Letter --|> LetterComposite
Sentence --|> LetterComposite
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>composite</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Data Access Object
folder: dao
permalink: /patterns/dao/
pumlid: 5SR14OKW30N0LhG0oVrt4o6ZE12Ov4NR_thQNQlc5aN2sd82qtz4naywAixOmyNoK8WYvT6fjdWOR7JnpLiHhuTkam4nTUhiRwZm847-J64zpUZj3m00
categories: Persistence Tier
tags:
- Java

65
dao/etc/dao.urm.puml Normal file
View File

@ -0,0 +1,65 @@
@startuml
package com.iluwatar.dao {
class InMemoryCustomerDao {
- idToCustomer : Map<Integer, Customer>
+ InMemoryCustomerDao()
+ add(customer : Customer) : boolean
+ delete(customer : Customer) : boolean
+ getAll() : Stream<Customer>
+ getById(id : int) : Optional<Customer>
+ update(customer : Customer) : boolean
}
interface CustomerSchemaSql {
+ CREATE_SCHEMA_SQL : String {static}
+ DELETE_SCHEMA_SQL : String {static}
}
interface CustomerDao {
+ add(Customer) : boolean {abstract}
+ delete(Customer) : boolean {abstract}
+ getAll() : Stream<Customer> {abstract}
+ getById(int) : Optional<Customer> {abstract}
+ update(Customer) : boolean {abstract}
}
class App {
- DB_URL : String {static}
- log : Logger {static}
+ App()
- addCustomers(customerDao : CustomerDao) {static}
- createDataSource() : DataSource {static}
- createSchema(dataSource : DataSource) {static}
- deleteSchema(dataSource : DataSource) {static}
+ generateSampleCustomers() : List<Customer> {static}
+ main(args : String[]) {static}
- performOperationsUsing(customerDao : CustomerDao) {static}
}
class DbCustomerDao {
- dataSource : DataSource
+ DbCustomerDao(dataSource : DataSource)
+ add(customer : Customer) : boolean
- createCustomer(resultSet : ResultSet) : Customer
+ delete(customer : Customer) : boolean
+ getAll() : Stream<Customer>
+ getById(id : int) : Optional<Customer>
- getConnection() : Connection
- mutedClose(connection : Connection)
+ update(customer : Customer) : boolean
}
class Customer {
- firstName : String
- id : int
- lastName : String
+ Customer(id : int, firstName : String, lastName : String)
+ equals(that : Object) : boolean
+ getFirstName() : String
+ getId() : int
+ getLastName() : String
+ hashCode() : int
+ setFirstName(firstName : String)
+ setId(id : int)
+ setLastName(lastName : String)
+ toString() : String
}
}
InMemoryCustomerDao ..|> CustomerDao
DbCustomerDao ..|> CustomerDao
@enduml

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>dao</artifactId>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Data Mapper
folder: data-mapper
permalink: /patterns/data-mapper/
pumlid: JShB3OGm303HLg20nFVjnYGM1CN6ycTfVtFSsnjfzY5jPgUqkLqHwXy0mxUU8wuyqidQ8q4IjJqCO-QBWGOtVh5qyd5AKOmW4mT6Nu2-ZiAekapH_hkcSTNa-GC0
categories: Persistence Tier
tags:
- Java

View File

@ -0,0 +1,42 @@
@startuml
package com.iluwatar.datamapper {
interface StudentDataMapper {
+ delete(Student) {abstract}
+ find(int) : Optional<Student> {abstract}
+ insert(Student) {abstract}
+ update(Student) {abstract}
}
class App {
- log : Logger {static}
- App()
+ main(args : String[]) {static}
}
class Student {
- grade : char
- name : String
- serialVersionUID : long {static}
- studentId : int
+ Student(studentId : int, name : String, grade : char)
+ equals(inputObject : Object) : boolean
+ getGrade() : char
+ getName() : String
+ getStudentId() : int
+ hashCode() : int
+ setGrade(grade : char)
+ setName(name : String)
+ setStudentId(studentId : int)
+ toString() : String
}
class StudentDataMapperImpl {
- students : List<Student>
+ StudentDataMapperImpl()
+ delete(studentToBeDeleted : Student)
+ find(studentId : int) : Optional<Student>
+ getStudents() : List<Student>
+ insert(studentToBeInserted : Student)
+ update(studentToBeUpdated : Student)
}
}
StudentDataMapperImpl --> "-students" Student
StudentDataMapperImpl ..|> StudentDataMapper
@enduml

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>data-mapper</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Decorator
folder: decorator
permalink: /patterns/decorator/
pumlid: HSV14SCm20J0Lk82BFxf1YF6LaP26ZZizfDVVhjRC-bPDRs_Bc35cyZvAMV3bKU6kao36ehCGQtdms2d3z-yLursshuOKBUWmV43LPNfZEcaaFzA-YWhH_y2
categories: Structural
tags:
- Java
@ -27,6 +28,14 @@ Use Decorator
* for responsibilities that can be withdrawn
* when extension by subclassing is impractical. Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing
## Real world examples
* [java.io.InputStream](http://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html), [java.io.OutputStream](http://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html),
[java.io.Reader](http://docs.oracle.com/javase/8/docs/api/java/io/Reader.html) and [java.io.Writer](http://docs.oracle.com/javase/8/docs/api/java/io/Writer.html)
* [java.util.Collections#synchronizedXXX()](http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#synchronizedCollection-java.util.Collection-)
* [java.util.Collections#unmodifiableXXX()](http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#unmodifiableCollection-java.util.Collection-)
* [java.util.Collections#checkedXXX()](http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#checkedCollection-java.util.Collection-java.lang.Class-)
## Credits
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)

View File

@ -0,0 +1,29 @@
@startuml
package com.iluwatar.decorator {
interface Hostile {
+ attack() {abstract}
+ fleeBattle() {abstract}
+ getAttackPower() : int {abstract}
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Troll {
+ Troll()
+ attack()
+ fleeBattle()
+ getAttackPower() : int
}
class SmartHostile {
- decorated : Hostile
+ SmartHostile(decorated : Hostile)
+ attack()
+ fleeBattle()
+ getAttackPower() : int
}
}
SmartHostile --> "-decorated" Hostile
Troll ..|> Hostile
SmartHostile ..|> Hostile
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>decorator</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Delegation
folder: delegation
permalink: /patterns/delegation/
pumlid: JSV14GCX20NGLf82LkxfXbN69OFeu2VRVdBCxRsdUhLiac6F2rZxHHHybwwuyimjKQT37ANEGMfvCpZepHy-ccpjVYm697pJuFq3DJ7f39rEWlhNaZ7Aoc5V
categories: Behavioral
tags:
- Java

View File

@ -0,0 +1,36 @@
@startuml
package com.iluwatar.delegation.simple.printers {
class HpPrinter {
+ HpPrinter()
+ print(message : String)
}
class EpsonPrinter {
+ EpsonPrinter()
+ print(message : String)
}
class CanonPrinter {
+ CanonPrinter()
+ print(message : String)
}
}
package com.iluwatar.delegation.simple {
class App {
+ MESSAGE_TO_PRINT : String {static}
+ App()
+ main(args : String[]) {static}
}
class PrinterController {
- printer : Printer
+ PrinterController(printer : Printer)
+ print(message : String)
}
interface Printer {
+ print(String) {abstract}
}
}
PrinterController --> "-printer" Printer
HpPrinter ..|> Printer
PrinterController ..|> Printer
EpsonPrinter ..|> Printer
CanonPrinter ..|> Printer
@enduml

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Dependency Injection
folder: dependency-injection
permalink: /patterns/dependency-injection/
pumlid: RSdB3SCW303GLPe1mFTkunWhSGG6-PEesxS3zFQajubIpyPf_NL6B7y363xra3XpJsUZgS4QbUO0wVbWeC65DvR6BeUMXH5iwZ3GVu36YxMnqgU8NamXKu63_aPD6tNbw5y0
categories: Behavioral
tags:
- Java

View File

@ -0,0 +1,48 @@
@startuml
package com.iluwatar.dependency.injection {
class AdvancedWizard {
- tobacco : Tobacco
+ AdvancedWizard(tobacco : Tobacco)
+ smoke()
}
interface Wizard {
+ smoke() {abstract}
}
class RivendellTobacco {
+ RivendellTobacco()
}
class SimpleWizard {
- tobacco : OldTobyTobacco
+ SimpleWizard()
+ smoke()
}
class OldTobyTobacco {
+ OldTobyTobacco()
}
class SecondBreakfastTobacco {
+ SecondBreakfastTobacco()
}
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class Tobacco {
+ Tobacco()
+ smoke(wizard : Wizard)
}
class GuiceWizard {
- tobacco : Tobacco
+ GuiceWizard(tobacco : Tobacco)
+ smoke()
}
}
SimpleWizard --> "-tobacco" OldTobyTobacco
AdvancedWizard --> "-tobacco" Tobacco
GuiceWizard --> "-tobacco" Tobacco
AdvancedWizard ..|> Wizard
RivendellTobacco --|> Tobacco
SimpleWizard ..|> Wizard
OldTobyTobacco --|> Tobacco
SecondBreakfastTobacco --|> Tobacco
GuiceWizard ..|> Wizard
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>dependency-injection</artifactId>
<dependencies>
@ -43,10 +43,9 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Double Checked Locking
folder: double-checked-locking
permalink: /patterns/double-checked-locking/
pumlid: TSdH4SCW203GLTe1bFzkGv1J6qGFeLc_MI1_x-wzkv94uJ1vDVUrFm26LwxTMnonsMYgitgcEQ1BNEXeyCKVfiAxLqqBtTbqmy1z0ygCGpXHOpgv99bqTgt0JW-LmqPUCUGF
categories: Concurrency
tags:
- Java

View File

@ -0,0 +1,20 @@
@startuml
package com.iluwatar.doublechecked.locking {
class App {
+ App()
+ main(args : String[]) {static}
}
class Inventory {
- inventorySize : int
- items : List<Item>
- lock : Lock
+ Inventory(inventorySize : int)
+ addItem(item : Item) : boolean
+ getItems() : List<Item>
}
class Item {
+ Item()
}
}
Inventory --> "-items" Item
@enduml

View File

@ -27,7 +27,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>double-checked-locking</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Double Dispatch
folder: double-dispatch
permalink: /patterns/double-dispatch/
pumlid: NSbB3iCW303HgpG70Ezx6yTOWSeOv4zp_MRTtUZDCPGa6wV9gqTiVmCOtlKQqVDCPwEbmHgLreGXUMEWmGU_M1hxkBHiZ61JXud-1BILft1fmvz37JZetshQh3kd_000
categories: Other
tags:
- Java

View File

@ -0,0 +1,65 @@
@startuml
package com.iluwatar.doubledispatch {
abstract class GameObject {
- damaged : boolean
- onFire : boolean
+ GameObject(left : int, top : int, right : int, bottom : int)
+ collision(GameObject) {abstract}
+ collisionResolve(FlamingAsteroid) {abstract}
+ collisionResolve(Meteoroid) {abstract}
+ collisionResolve(SpaceStationIss) {abstract}
+ collisionResolve(SpaceStationMir) {abstract}
+ isDamaged() : boolean
+ isOnFire() : boolean
+ setDamaged(damaged : boolean)
+ setOnFire(onFire : boolean)
+ toString() : String
}
class SpaceStationIss {
+ SpaceStationIss(left : int, top : int, right : int, bottom : int)
+ collision(gameObject : GameObject)
}
class FlamingAsteroid {
+ FlamingAsteroid(left : int, top : int, right : int, bottom : int)
+ collision(gameObject : GameObject)
}
class SpaceStationMir {
+ SpaceStationMir(left : int, top : int, right : int, bottom : int)
+ collision(gameObject : GameObject)
+ collisionResolve(asteroid : FlamingAsteroid)
+ collisionResolve(iss : SpaceStationIss)
+ collisionResolve(meteoroid : Meteoroid)
+ collisionResolve(mir : SpaceStationMir)
}
class Meteoroid {
+ Meteoroid(left : int, top : int, right : int, bottom : int)
+ collision(gameObject : GameObject)
+ collisionResolve(asteroid : FlamingAsteroid)
+ collisionResolve(iss : SpaceStationIss)
+ collisionResolve(meteoroid : Meteoroid)
+ collisionResolve(mir : SpaceStationMir)
}
class Rectangle {
- bottom : int
- left : int
- right : int
- top : int
+ Rectangle(left : int, top : int, right : int, bottom : int)
+ getBottom() : int
+ getLeft() : int
+ getRight() : int
+ getTop() : int
~ intersectsWith(r : Rectangle) : boolean
+ toString() : String
}
class App {
+ App()
+ main(args : String[]) {static}
}
}
GameObject --|> Rectangle
SpaceStationIss --|> SpaceStationMir
FlamingAsteroid --|> Meteoroid
SpaceStationMir --|> GameObject
Meteoroid --|> GameObject
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>double-dispatch</artifactId>
<dependencies>

View File

@ -3,10 +3,12 @@ layout: pattern
title: Event Aggregator
folder: event-aggregator
permalink: /patterns/event-aggregator/
pumlid: PSf13iCW30NHgxG70Ezx6uTOX0eCih-JwvTzTwEdUJSjFKu9wwyBMFuXCdvoRRZY21ShKo6ANEQWrkDXiD6NRqwdUAkQ5WDYwZJOTv3SUqzSgqbbp0qeVvZ3Hbun-Wy0
categories: Structural
tags:
- Java
- Difficulty-Beginner
- Reactive
---
## Intent

View File

@ -0,0 +1,73 @@
@startuml
package com.iluwatar.event.aggregator {
class LordVarys {
+ LordVarys()
+ LordVarys(obs : EventObserver)
+ timePasses(day : Weekday)
}
abstract class EventEmitter {
- observers : List<EventObserver>
+ EventEmitter()
+ EventEmitter(obs : EventObserver)
# notifyObservers(e : Event)
+ registerObserver(obs : EventObserver)
+ timePasses(Weekday) {abstract}
}
class KingJoffrey {
+ KingJoffrey()
+ onEvent(e : Event)
}
class LordBaelish {
+ LordBaelish()
+ LordBaelish(obs : EventObserver)
+ timePasses(day : Weekday)
}
interface EventObserver {
+ onEvent(Event) {abstract}
}
class KingsHand {
+ KingsHand()
+ KingsHand(obs : EventObserver)
+ onEvent(e : Event)
+ timePasses(day : Weekday)
}
class Scout {
+ Scout()
+ Scout(obs : EventObserver)
+ timePasses(day : Weekday)
}
class App {
+ App()
+ main(args : String[]) {static}
}
enum Weekday {
+ FRIDAY {static}
+ MONDAY {static}
+ SATURDAY {static}
+ SUNDAY {static}
+ THURSDAY {static}
+ TUESDAY {static}
+ WEDNESDAY {static}
- description : String
+ toString() : String
+ valueOf(name : String) : Weekday {static}
+ values() : Weekday[] {static}
}
enum Event {
+ STARK_SIGHTED {static}
+ TRAITOR_DETECTED {static}
+ WARSHIPS_APPROACHING {static}
- description : String
+ toString() : String
+ valueOf(name : String) : Event {static}
+ values() : Event[] {static}
}
}
EventEmitter --> "-observers" EventObserver
LordVarys --|> EventEmitter
KingJoffrey ..|> EventObserver
LordBaelish --|> EventEmitter
KingsHand ..|> EventObserver
KingsHand --|> EventEmitter
Scout --|> EventEmitter
@enduml

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>event-aggregator</artifactId>
<dependencies>

View File

@ -1,7 +1,15 @@
---
layout: pattern
title: Event Driven Architecture
folder: event-driven-architecture
permalink: /patterns/event-driven-architecture
permalink: /patterns/event-driven-architecture/
pumlid: TOhH3SCW30LNQGS0_tSRnrZ15H1adfFromBzkfFktZQaHT7mzgh0N1yYvoUVXXf7B7Mv1dGWozN9MZmCTlhopQdeidEaoO3wMDHvRI6zzvwAssPYbsfGGRYIGlxN7DxpZDv-
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Reactive
---
## Intent
Send and notify state changes of your objects to other applications using an Event-driven Architecture.

View File

@ -0,0 +1,62 @@
@startuml
package com.iluwatar.eda.handler {
class UserCreatedEventHandler {
+ UserCreatedEventHandler()
+ onEvent(event : UserCreatedEvent)
}
class UserUpdatedEventHandler {
+ UserUpdatedEventHandler()
+ onEvent(event : UserUpdatedEvent)
}
}
package com.iluwatar.eda.event {
abstract class AbstractEvent {
+ AbstractEvent()
+ getType() : Class<? extends Event>
}
class UserCreatedEvent {
- user : User
+ UserCreatedEvent(user : User)
+ getUser() : User
}
class UserUpdatedEvent {
- user : User
+ UserUpdatedEvent(user : User)
+ getUser() : User
}
}
package com.iluwatar.eda.framework {
interface Handler<E extends Event> {
+ onEvent(E extends Event) {abstract}
}
class EventDispatcher {
- handlers : Map<Class<? extends Event>, Handler<? extends Event>>
+ EventDispatcher()
+ dispatch(event : E extends Event)
+ registerHandler(eventType : Class<E extends Event>, handler : Handler<E extends Event>)
}
interface Event {
+ getType() : Class<? extends Event> {abstract}
}
}
package com.iluwatar.eda.model {
class User {
- username : String
+ User(username : String)
+ getUsername() : String
}
}
package com.iluwatar.eda {
class App {
+ App()
+ main(args : String[]) {static}
}
}
UserUpdatedEvent --> "-user" User
UserCreatedEvent --> "-user" User
AbstractEvent ..|> Event
UserCreatedEvent --|> AbstractEvent
UserCreatedEventHandler ..|> Handler
UserUpdatedEvent --|> AbstractEvent
UserUpdatedEventHandler ..|> Handler
@enduml

View File

@ -31,7 +31,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>event-driven-architecture</artifactId>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Execute Around
folder: execute-around
permalink: /patterns/execute-around/
pumlid: NSZ14G8n20NGLhI0XBlT865suoGa0n_NylNixSsxTvEHJTF7xGHsF8YShtfqdFdCK9TbK4ELDQcFl1ZizE8tbwRH3okR0NKBcXm_a7vK4bhOLreZXVnLJPzrvnnV
categories: Other
tags:
- Java

View File

@ -0,0 +1,14 @@
@startuml
package com.iluwatar.execute.around {
class SimpleFileWriter {
+ SimpleFileWriter(filename : String, action : FileWriterAction)
}
class App {
+ App()
+ main(args : String[]) {static}
}
interface FileWriterAction {
+ writeFile(FileWriter) {abstract}
}
}
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>execute-around</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Facade
folder: facade
permalink: /patterns/facade/
pumlid: BSP15eCm20N0gxG7CEoz3ILKqvTW7dpq-hhehERTJ7fMJU-l7PYn4ZbVPMlOyvEXBeT13KMEGQtdnM2d7v-yL8sssJ8PKBUWmV64lYnSbHJoRqaVPUReDm00
categories: Structural
tags:
- Java

View File

@ -0,0 +1,57 @@
@startuml
package com.iluwatar.facade {
class DwarvenGoldDigger {
+ DwarvenGoldDigger()
+ name() : String
+ work()
}
class DwarvenGoldmineFacade {
- workers : List<DwarvenMineWorker>
+ DwarvenGoldmineFacade()
+ digOutGold()
+ endDay()
- makeActions(workers : Collection<DwarvenMineWorker>, actions : Action[]) {static}
+ startNewDay()
}
class DwarvenTunnelDigger {
+ DwarvenTunnelDigger()
+ name() : String
+ work()
}
abstract class DwarvenMineWorker {
+ DwarvenMineWorker()
- action(action : Action)
+ action(actions : Action[])
+ goHome()
+ goToMine()
+ goToSleep()
+ name() : String {abstract}
+ wakeUp()
+ work() {abstract}
}
class App {
+ App()
+ main(args : String[]) {static}
}
class DwarvenCartOperator {
+ DwarvenCartOperator()
+ name() : String
+ work()
}
~enum Action {
+ GO_HOME {static}
+ GO_TO_MINE {static}
+ GO_TO_SLEEP {static}
+ WAKE_UP {static}
+ WORK {static}
+ valueOf(name : String) : Action {static}
+ values() : Action[] {static}
}
}
DwarvenGoldmineFacade --+ DwarvenMineWorker
DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker
Action ..+ DwarvenMineWorker
DwarvenGoldDigger --|> DwarvenMineWorker
DwarvenTunnelDigger --|> DwarvenMineWorker
DwarvenCartOperator --|> DwarvenMineWorker
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>facade</artifactId>
<dependencies>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Factory Kit
folder: factory-kit
permalink: /patterns/factory-kit/
pumlid: JST15i8m20N0g-W14lRU1YcsQ4BooCS-RwzBTpDNSscvQKQx7C1SDwBWi-w68--vD6Gur55bTBAM9uE3dlpcikcotSjaGCCNTLu_q8C58pxbPI25_Bzcz3gpjoy0
categories: Creational
tags:
- Java

View File

@ -0,0 +1,45 @@
@startuml
package com.iluwatar.factorykit {
class Spear {
+ Spear()
+ toString() : String
}
class App {
+ App()
+ main(args : String[]) {static}
}
interface Weapon {
}
interface WeaponFactory {
+ create(WeaponType) : Weapon {abstract}
+ factory(consumer : Consumer<Builder>) : WeaponFactory {static}
}
class Axe {
+ Axe()
+ toString() : String
}
class Sword {
+ Sword()
+ toString() : String
}
class Bow {
+ Bow()
+ toString() : String
}
interface Builder {
+ add(WeaponType, Supplier<Weapon>) {abstract}
}
enum WeaponType {
+ AXE {static}
+ BOW {static}
+ SPEAR {static}
+ SWORD {static}
+ valueOf(name : String) : WeaponType {static}
+ values() : WeaponType[] {static}
}
}
Spear ..|> Weapon
Axe ..|> Weapon
Sword ..|> Weapon
Bow ..|> Weapon
@enduml

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>factory-kit</artifactId>
<dependencies>

View File

@ -3,8 +3,9 @@ layout: pattern
title: Factory Method
folder: factory-method
permalink: /patterns/factory-method/
pumlid: NSZB3G8n30N0Lg20n7UwCOxPP9MVx6TMT0zdRgEvjoazYeRrMmMsFuYChtmqr7Y6gycQq8aiQr3hSJ7OwEGtfwBUZfas0shJQR3_G2yMBFkaeQYha4B-AeUDl6FqBm00
categories: Creational
tags:
tags:
- Java
- Difficulty-Beginner
- Gang Of Four
@ -27,6 +28,16 @@ Use the Factory Method pattern when
* a class wants its subclasses to specify the objects it creates
* classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate
## Known uses
* [java.util.Calendar](http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance--)
* [java.util.ResourceBundle](http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html#getBundle-java.lang.String-)
* [java.text.NumberFormat](http://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.html#getInstance--)
* [java.nio.charset.Charset](http://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html#forName-java.lang.String-)
* [java.net.URLStreamHandlerFactory](http://docs.oracle.com/javase/8/docs/api/java/net/URLStreamHandlerFactory.html#createURLStreamHandler-java.lang.String-)
* [java.util.EnumSet](https://docs.oracle.com/javase/8/docs/api/java/util/EnumSet.html#of-E-)
* [javax.xml.bind.JAXBContext](https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXBContext.html#createMarshaller--)
## Credits
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)

View File

@ -0,0 +1,53 @@
@startuml
package com.iluwatar.factory.method {
class OrcBlacksmith {
+ OrcBlacksmith()
+ manufactureWeapon(weaponType : WeaponType) : Weapon
}
class ElfBlacksmith {
+ ElfBlacksmith()
+ manufactureWeapon(weaponType : WeaponType) : Weapon
}
class OrcWeapon {
- weaponType : WeaponType
+ OrcWeapon(weaponType : WeaponType)
+ getWeaponType() : WeaponType
+ toString() : String
}
interface Blacksmith {
+ manufactureWeapon(WeaponType) : Weapon {abstract}
}
class ElfWeapon {
- weaponType : WeaponType
+ ElfWeapon(weaponType : WeaponType)
+ getWeaponType() : WeaponType
+ toString() : String
}
class App {
- blacksmith : Blacksmith
+ App(blacksmith : Blacksmith)
+ main(args : String[]) {static}
- manufactureWeapons()
}
interface Weapon {
+ getWeaponType() : WeaponType {abstract}
}
enum WeaponType {
+ AXE {static}
+ SHORT_SWORD {static}
+ SPEAR {static}
+ UNDEFINED {static}
- title : String
+ toString() : String
+ valueOf(name : String) : WeaponType {static}
+ values() : WeaponType[] {static}
}
}
ElfWeapon --> "-weaponType" WeaponType
OrcWeapon --> "-weaponType" WeaponType
App --> "-blacksmith" Blacksmith
OrcBlacksmith ..|> Blacksmith
ElfBlacksmith ..|> Blacksmith
OrcWeapon ..|> Weapon
ElfWeapon ..|> Weapon
@enduml

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<artifactId>factory-method</artifactId>
<dependencies>

10
faq.md
View File

@ -3,7 +3,7 @@ layout: page
title: FAQ
permalink: /faq/
icon: fa-question
page-index: 1
page-index: 5
---
### Q1: What is the difference between State and Strategy patterns? {#Q1}
@ -65,3 +65,11 @@ Flyweight.
### Q7: What are the differences between FluentInterface and Builder patterns? {#Q7}
Fluent interfaces are sometimes confused with the Builder pattern, because they share method chaining and a fluent usage. However, fluent interfaces are not primarily used to create shared (mutable) objects, but to configure complex objects without having to respecify the target object on every property change.
### Q8: What is the difference between java.io.Serialization and Memento pattern? {#Q8}
Memento is typically used to implement rollback/save-point support. Example we might want to mark the state of an object at a point in time, do some work and then decide to rollback to the previous state.
On the other hand serialization may be used as a tool to save the state of an object into byte[] and preserving the contents in memory or disk. When someone invokes the memento to revert object's previous state then we can deserialize the information stored and recreate previous state.
So Memento is a pattern and serialization is a tool that can be used to implement this pattern. Other ways to implement the pattern can be to clone the contents of the object and keep track of those clones.

View File

@ -3,6 +3,7 @@ layout: pattern
title: Feature Toggle
folder: feature-toggle
permalink: /patterns/feature-toggle/
pumlid: NSZ14G8X30NGLhG0oDrk8XjPd12OvCTjNy_UthpxiAPvIBhUJc37WyZvgdtWp6U6U5i6CTIs9WtDYy5ER_vmEIH6jx8P4BUWoV43lOIHBWMhTnKIjB-gwRFkdFe5
categories: Behavioral
tags:
- Java

View File

@ -0,0 +1,47 @@
@startuml
package com.iluwatar.featuretoggle.pattern {
interface Service {
+ getWelcomeMessage(User) : String {abstract}
+ isEnhanced() : boolean {abstract}
}
}
package com.iluwatar.featuretoggle.user {
class User {
- name : String
+ User(name : String)
+ toString() : String
}
class UserGroup {
- freeGroup : List<User> {static}
- paidGroup : List<User> {static}
+ UserGroup()
+ addUserToFreeGroup(user : User) {static}
+ addUserToPaidGroup(user : User) {static}
+ isPaid(user : User) : boolean {static}
}
}
package com.iluwatar.featuretoggle.pattern.tieredversion {
class TieredFeatureToggleVersion {
+ TieredFeatureToggleVersion()
+ getWelcomeMessage(user : User) : String
+ isEnhanced() : boolean
}
}
package com.iluwatar.featuretoggle.pattern.propertiesversion {
class PropertiesFeatureToggleVersion {
- isEnhanced : boolean
+ PropertiesFeatureToggleVersion(properties : Properties)
+ getWelcomeMessage(user : User) : String
+ isEnhanced() : boolean
}
}
package com.iluwatar.featuretoggle {
class App {
+ App()
+ main(args : String[]) {static}
}
}
UserGroup --> "-freeGroup" User
PropertiesFeatureToggleVersion ..|> Service
TieredFeatureToggleVersion ..|> Service
@enduml

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.12.0</version>
<version>1.13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,6 +3,7 @@ layout: pattern
title: Fluent Interface
folder: fluentinterface
permalink: /patterns/fluentinterface/
pumlid: NOj93eCm302_KXv0VEzlN6F0bMCYB_3zvjpRQ3IpY97MnkNwEZD7l04SdtP8dlMfOAVBaYqRNHr4wy54Xo_Uk6uSSjWwC9FT0Zh61DYrPY_pyXs9WPF-NIllRLJN7m00
categories: Other
tags:
- Java

Some files were not shown because too many files have changed in this diff Show More