├── .gitignore
├── LICENSE.md
├── README.md
├── pom.xml
└── src
└── main
└── java
└── org
└── microserviceapipatterns
└── domaindrivendesign
├── AbstractAggregate.java
├── AbstractEntity.java
├── Aggregate.java
├── AntiCorruptionLayer.java
├── ApplicationService.java
├── BoundedContext.java
├── DomainEvent.java
├── DomainService.java
├── Entity.java
├── EntityIdentifier.java
├── Factory.java
├── InfrastructureService.java
├── Repository.java
├── RootEntity.java
├── Service.java
└── ValueObject.java
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle
25 | customerselfservice.mv.db
26 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Eclipse Public License - v 2.0
2 | ==============================
3 |
4 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
5 |
6 | ### 1. Definitions
7 |
8 | “Contribution” means:
9 | * **a)** in the case of the initial Contributor, the initial content Distributed under this Agreement, and
10 | * **b)** in the case of each subsequent Contributor:
11 | * **i)** changes to the Program, and
12 | * **ii)** additions to the Program;
13 | where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works.
14 |
15 | “Contributor” means any person or entity that Distributes the Program.
16 |
17 | “Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
18 |
19 | “Program” means the Contributions Distributed in accordance with this Agreement.
20 |
21 | “Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors.
22 |
23 | “Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
24 |
25 | “Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof.
26 |
27 | “Distribute” means the acts of **a)** distributing or **b)** making available in any manner that enables the transfer of a copy.
28 |
29 | “Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files.
30 |
31 | “Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor.
32 |
33 | ### 2. Grant of Rights
34 |
35 | **a)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works.
36 |
37 | **b)** Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
38 |
39 | **c)** Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
40 |
41 | **d)** Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
42 |
43 | **e)** Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3).
44 |
45 | ### 3. Requirements
46 |
47 | **3.1** If a Contributor Distributes the Program in any form, then:
48 |
49 | * **a)** the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and
50 |
51 | * **b)** the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:
52 | * **i)** effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
53 | * **ii)** effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
54 | * **iii)** does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and
55 | * **iv)** requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.
56 |
57 | **3.2** When the Program is Distributed as Source Code:
58 |
59 | * **a)** it must be made available under this Agreement, or if the Program **(i)** is combined with other material in a separate file or files made available under a Secondary License, and **(ii)** the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and
60 | * **b)** a copy of this Agreement must be included with each copy of the Program.
61 |
62 | **3.3** Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (“notices”) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.
63 |
64 | ### 4. Commercial Distribution
65 |
66 | Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: **a)** promptly notify the Commercial Contributor in writing of such claim, and **b)** allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
67 |
68 | For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
69 |
70 | ### 5. No Warranty
71 |
72 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
73 |
74 | ### 6. Disclaimer of Liability
75 |
76 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
77 |
78 | ### 7. General
79 |
80 | If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
81 |
82 | If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
83 |
84 | All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
85 |
86 | Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version.
87 |
88 | Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
89 |
90 | #### Exhibit A - Form of Secondary Licenses Notice
91 |
92 | > “This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.”
93 |
94 | Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses.
95 |
96 | If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
97 |
98 | You may add additional accurate notices of copyright ownership.
99 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Domain-Driven Design Library
2 |
3 | This library is a collection of interfaces and abstract classes to express domain-driven design concepts in Java code. Most types in this library are pure marker interfaces and only for documentation purposes. An added benefit is that IDEs can show all implementations of an interface, thus making it easy to discover all implementations of for example Value Objects or Entities.
4 |
5 |
6 | ## Pattern representations
7 |
8 |
20 |
21 | | Pattern (or Variant) | Implementation in this library | Example in [Lakeside Mutual](https://github.com/Microservice-API-Patterns/LakesideMutual) |
22 | | -------------------- | ------------------------------ |------------------------- |
23 | | Layered Architecture | n/a | Top-level packages in Lakeside Mutual backend represents the layers suggested by E. Evans in the ["light blue" book](http://dddcommunity.org/book/evans_2003/) |
24 | | Module | n/a | Java sub-packages in Domain Layer of Lakeside Mutual backends |
25 | | Entity | [Entity](src/main/java/org/microserviceapipatterns/domaindrivendesign/Entity.java) | [CustomerProfileEntity](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-core/src/main/java/com/lakesidemutual/customercore/domain/customer/CustomerProfileEntity.java) |
26 | | Value Object | [ValueObject](src/main/java/org/microserviceapipatterns/domaindrivendesign/ValueObject.java) | [PolicyPeriod](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/policy-management-backend/src/main/java/com/lakesidemutual/policymanagement/domain/policy/PolicyPeriod.java) |
27 | | Service | [Service](src/main/java/org/microserviceapipatterns/domaindrivendesign/Service.java) | See layer-specific variants below: |
28 | | Application Service | [ApplicationService](src/main/java/org/microserviceapipatterns/domaindrivendesign/ApplicationService.java) | [CustomerService](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-core/src/main/java/com/lakesidemutual/customercore/application/CustomerService.java) |
29 | | Domain Service | [DomainService](src/main/java/org/microserviceapipatterns/domaindrivendesign/DomainService.java) | [InteractionLogService](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-management-backend/src/main/java/com/lakesidemutual/customermanagement/domain/InteractionLogService.java) |
30 | | Infrastructure Service| [InfrastructureService](src/main/java/org/microserviceapipatterns/domaindrivendesign/InfrastructureService.java) | [CustomerCoreService](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-management-backend/src/main/java/com/lakesidemutual/customermanagement/infrastructure/CustomerCoreService.java) |
31 | | Repository | [Repository](src/main/java/org/microserviceapipatterns/domaindrivendesign/Repository.java) | [CustomerRepository](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-core/src/main/java/com/lakesidemutual/customercore/infrastructure/CustomerRepository.java) |
32 | | Factory | [Factory ](src/main/java/org/microserviceapipatterns/domaindrivendesign/Factory.java) | [CustomerFactory](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-core/src/main/java/com/lakesidemutual/customercore/domain/customer/CustomerFactory.java) |
33 | | Aggregate | [Aggregate](src/main/java/org/microserviceapipatterns/domaindrivendesign/Aggregate.java) | [CustomerAggregateRoot](https://github.com/Microservice-API-Patterns/LakesideMutual/tree/master/customer-core/src/main/java/com/lakesidemutual/customercore/domain/customer/CustomerAggregateRoot.java) |
34 | | Bounded Context | [BoundedContext](src/main/java/org/microserviceapipatterns/domaindrivendesign/BoundedContext.java) | CustomerCoreApplication |
35 | | Context Map | n/a | n/a |
36 | | Subdomain patterns | n/a | n/a |
37 |
38 |
39 |
40 | ## More Information
41 | [This website](https://www.ifs.hsr.ch/index.php?id=15666&L=4) collects pointers to DDD resources, for instance:
42 |
43 | * This [DDD reference](http://domainlanguage.com/ddd/reference/) has pattern summaries.
44 | * The [DDD community](http://dddcommunity.org/learning-ddd/what_is_ddd/) features supporting material.
45 | * [InfoQ](https://www.infoq.com/domain-driven-design) provides articles and presentations around DDD.
46 |
47 | ### DDD Example(s)
48 | This DDD library was developed for the [Lakeside Mutual](https://github.com/Microservice-API-Patterns/LakesideMutual) sample application.
49 |
50 | The [DDD Sample Application](https://github.com/citerus/dddsample-core) that implements the running example in Eric Evans' [Domain-Driven Design](https://domainlanguage.com/ddd/) is also available on GitHub. It deals with cargo booking, routing and tracking.
51 |
52 | The [agile project management sample](https://github.com/VaughnVernon/IDDD_Samples) accompanying [Implementing Domain-Driven Design](http://www.informit.com/store/implementing-domain-driven-design-9780321834577) by Vaughn Vernon can be found on GitHub as well.
53 |
54 |
55 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | org.microservice-api-patterns
5 | domaindrivendesign-library
6 | 0.2.5-SNAPSHOT
7 | jar
8 |
9 |
10 | UTF-8
11 | 1.8
12 |
13 |
14 | Domain-Driven-Design Library
15 | https://github.com/Microservice-API-Patterns/DDD-Library
16 | A collection of interfaces and abstract classes to express domain-driven design concepts in Java code used for teaching.
17 |
18 |
19 | Eclipse Public License 2.0
20 | https://github.com/Microservice-API-Patterns/DDD-Library/blob/master/LICENSE.md
21 |
22 |
23 |
24 |
25 | Mirko Stocker
26 | info@microservice-api-patterns.org
27 | Microservice-API-Patterns
28 | https://github.com/Microservice-API-Patterns
29 |
30 |
31 |
32 | scm:git:https://github.com/Microservice-API-Patterns/DDD-Library.git
33 | scm:git:git@github.com:Microservice-API-Patterns/DDD-Library.git
34 | https://github.com/Microservice-API-Patterns/DDD-Library
35 | HEAD
36 |
37 |
38 |
39 | ossrh
40 | https://oss.sonatype.org/content/repositories/snapshots
41 |
42 |
43 | ossrh
44 | https://oss.sonatype.org/service/local/staging/deploy/maven2
45 |
46 |
47 |
48 |
49 |
50 | org.apache.maven.plugins
51 | maven-compiler-plugin
52 | 3.8.0
53 |
54 | 1.8
55 | 1.8
56 |
57 |
58 |
59 | org.sonatype.plugins
60 | nexus-staging-maven-plugin
61 | 1.6.7
62 | true
63 |
64 | ossrh
65 | https://oss.sonatype.org/
66 | true
67 |
68 |
69 |
70 | org.apache.maven.plugins
71 | maven-source-plugin
72 | 2.2.1
73 |
74 |
75 | attach-sources
76 |
77 | jar-no-fork
78 |
79 |
80 |
81 |
82 |
83 | org.apache.maven.plugins
84 | maven-javadoc-plugin
85 | 2.9.1
86 |
87 |
88 | attach-javadocs
89 |
90 | jar
91 |
92 |
93 |
94 |
95 |
96 | org.apache.maven.plugins
97 | maven-gpg-plugin
98 | 1.5
99 |
100 |
101 | sign-artifacts
102 | verify
103 |
104 | sign
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | src/main/java
113 | false
114 |
115 |
116 | src/main/resources
117 | false
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/AbstractAggregate.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * An experimental abstract base class for @Aggregates that could be used to
5 | * abstract over common features of aggregates.
6 | */
7 | public abstract class AbstractAggregate implements Aggregate {
8 |
9 | // just a placeholder/demonstrator:
10 | abstract public boolean checkInvariants();
11 |
12 | // just a placeholder/demonstrator:
13 | abstract Entity getRootById(EntityIdentifier globalId);
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/AbstractEntity.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * An experimental abstract base class for @Entity that could be used to
5 | * abstract over common features of entities.
6 | */
7 | public abstract class AbstractEntity> implements Entity {
8 | private T localId;
9 |
10 | AbstractEntity(T id) {
11 | this.localId = id;
12 | }
13 |
14 | // just a placeholder/demonstrator (could add more methods from "DDD metamodel")
15 | abstract public String modifyEntity(String parameters);
16 |
17 | public T getLocalId() {
18 | return localId;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/Aggregate.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Aggregates. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface Aggregate {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/AntiCorruptionLayer.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * An experimental marker interfaces for an AntiCorruptionLayer. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | *
8 | * This is just an idea we're exploring, the other context relationship types
9 | * are not represented because they have a "connector" character, rather than
10 | * "component"
11 | */
12 | public interface AntiCorruptionLayer {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/ApplicationService.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for ApplicationServices. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface ApplicationService extends Service {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/BoundedContext.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Bounded Contexts. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface BoundedContext {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/DomainEvent.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Domain Events. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | *
8 | * This interface is an experiment to provide an AbstractDomainEvent that
9 | * implements this interface and has common data members such as a timestamp
10 | * (inspired by the
12 | * https://www.enterpriseintegrationpatterns.com/patterns/messaging/EventMessage.html
13 | * and the Implementing DDD book).
14 | */
15 | public interface DomainEvent {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/DomainService.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Domain Services. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface DomainService extends Service {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/Entity.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for an Entity. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface Entity {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/EntityIdentifier.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * An experimental interface to mark @Entity identifiers.
5 | *
6 | * @param
7 | * The type of the underlying implementation, e.g. a String or UUID.
8 | */
9 | public interface EntityIdentifier {
10 |
11 | T getId();
12 |
13 | }
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/Factory.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Factories. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface Factory {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/InfrastructureService.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Infrastructure Services. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface InfrastructureService extends Service {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/Repository.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Repositories. Note that it is a recommended practice
5 | * in DDD to define only one @Repository per @Aggregate because these are the
6 | * "units of storage and transfer".
7 | *
8 | * See https://domainlanguage.com/ddd/reference/
10 | * for details.
11 | *
12 | */
13 | public interface Repository {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/RootEntity.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Root Entities, also known as Aggregate Roots. See
5 | * https://domainlanguage.com/ddd/reference/
7 | * for details.
8 | */
9 | public interface RootEntity extends Entity {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/Service.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Services. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | */
8 | public interface Service {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/microserviceapipatterns/domaindrivendesign/ValueObject.java:
--------------------------------------------------------------------------------
1 | package org.microserviceapipatterns.domaindrivendesign;
2 |
3 | /**
4 | * A marker interfaces for Value Objects. See https://domainlanguage.com/ddd/reference/
6 | * for details.
7 | *
8 | * Value Objects are immutable and have structural equality, so they need to
9 | * implement equals and hashCode. Unfortunately, this can't be enforced in the
10 | * Java type system, so this remains a marker interface without any methods.
11 | */
12 | public interface ValueObject {
13 |
14 | }
15 |
--------------------------------------------------------------------------------