Class JMoleculesRules

java.lang.Object
org.jmolecules.archunit.JMoleculesRules

@Deprecated public class JMoleculesRules extends Object
Deprecated.
since 0.5, for removal in 0.6. Use JMoleculesDddRules instead.
A set of ArchUnit rules that allow verification of domain models. In short the rules here verify:
  • Aggregates only refer to entities that are declared to be part of it.
  • References to other aggregates are established via Associations or identifier references.
Those rules are mostly driven by what's been presented by John Sullivan in his blog post here.
Author:
Oliver Drotbohm
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.tngtech.archunit.lang.ArchRule
    Deprecated.
    An ArchRule that ensures that one AggregateRoot does not reference another via the remote AggregateRoot type but rather via their identifier type or an explicit Association type.
    static com.tngtech.archunit.lang.ArchRule
    all()
    Deprecated.
    An ArchRule that's composed of all other rules declared in this class.
    static com.tngtech.archunit.lang.ArchRule
    Deprecated.
    An ArchRule that verifies that fields that implement Entity within a type implementing AggregateRoot declare the aggregate type as the owning aggregate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JMoleculesRules

      public JMoleculesRules()
      Deprecated.
  • Method Details

    • all

      public static com.tngtech.archunit.lang.ArchRule all()
      Deprecated.
      An ArchRule that's composed of all other rules declared in this class.
      Returns:
      See Also:
    • entitiesShouldBeDeclaredForUseInSameAggregate

      public static com.tngtech.archunit.lang.ArchRule entitiesShouldBeDeclaredForUseInSameAggregate()
      Deprecated.
      An ArchRule that verifies that fields that implement Entity within a type implementing AggregateRoot declare the aggregate type as the owning aggregate.

      class Customer implements AggregateRoot<Customer, CustomerId> { … } class Address implements Entity<Customer, AddressId> { … } class LineItem implements Entity<Order, LineItemId> { … } class Order implements AggregateRoot<Order, OrderId> { List lineItems; // valid Address shippingAddress; // invalid as Address is declared to belong to Customer }

      Returns:
      will never be null.
    • aggregateReferencesShouldBeViaIdOrAssociation

      public static com.tngtech.archunit.lang.ArchRule aggregateReferencesShouldBeViaIdOrAssociation()
      Deprecated.
      An ArchRule that ensures that one AggregateRoot does not reference another via the remote AggregateRoot type but rather via their identifier type or an explicit Association type.

      class Customer implements AggregateRoot<Customer, CustomerId> { … } class Order implements AggregateRoot<Order, OrderId> { Customer customer; // invalid CustomerId customerId; // valid Association customer; // valid }

      Returns:
      will never be null.