Package com.tngtech.archunit.library
Class Architectures.OnionArchitecture
java.lang.Object
com.tngtech.archunit.library.Architectures.OnionArchitecture
- All Implemented Interfaces:
HasDescription
,CanOverrideDescription<ArchRule>
,ArchRule
,CanBeEvaluated
- Enclosing class:
- Architectures
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tngtech.archunit.lang.ArchRule
ArchRule.Assertions, ArchRule.Factory, ArchRule.Transformation
-
Method Summary
Modifier and TypeMethodDescriptionallowEmptyShould
(boolean allowEmptyShould) This method is equivalent to callingwithOptionalLayers(boolean)
, which should be preferred in this context as the meaning is easier to understand.applicationServices
(String... packageIdentifiers) Allows to adjust the description of this object.void
check
(JavaClasses classes) domainModels
(String... packageIdentifiers) domainServices
(String... packageIdentifiers) evaluate
(JavaClasses classes) ignoreDependency
(DescribedPredicate<? super JavaClass> origin, DescribedPredicate<? super JavaClass> target) ignoreDependency
(Class<?> origin, Class<?> target) ignoreDependency
(String origin, String target) withOptionalLayers
(boolean optionalLayers)
-
Method Details
-
domainModels
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture domainModels(String... packageIdentifiers) -
domainServices
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture domainServices(String... packageIdentifiers) -
applicationServices
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture applicationServices(String... packageIdentifiers) -
adapter
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture adapter(String name, String... packageIdentifiers) -
withOptionalLayers
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture withOptionalLayers(boolean optionalLayers) - Parameters:
optionalLayers
- Whether the different parts of the Onion Architecture (domain models, domain services, ...) should be allowed to be empty. If set tofalse
theOnionArchitecture
will fail if any such layer does not contain any class.
-
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture ignoreDependency(Class<?> origin, Class<?> target) -
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture ignoreDependency(String origin, String target) -
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.OnionArchitecture ignoreDependency(DescribedPredicate<? super JavaClass> origin, DescribedPredicate<? super JavaClass> target) -
check
-
because
-
allowEmptyShould
This method is equivalent to callingwithOptionalLayers(boolean)
, which should be preferred in this context as the meaning is easier to understand.- Specified by:
allowEmptyShould
in interfaceArchRule
- Parameters:
allowEmptyShould
- Whether the rule fails if the should-clause is evaluated with an empty set of elements- Returns:
- A (new)
ArchRule
with adjustedallowEmptyShould
behavior
-
as
Description copied from interface:CanOverrideDescription
Allows to adjust the description of this object. Note that this method will not modify the current object, but instead return a new object with adjusted description.- Specified by:
as
in interfaceCanOverrideDescription<ArchRule>
- Parameters:
newDescription
- The description the result of this method will hold- Returns:
- A new equivalent object with adjusted description
-
evaluate
- Specified by:
evaluate
in interfaceCanBeEvaluated
-
getDescription
- Specified by:
getDescription
in interfaceHasDescription
-