Package com.tngtech.archunit.library
Class Architectures.LayeredArchitecture
java.lang.Object
com.tngtech.archunit.library.Architectures.LayeredArchitecture
- All Implemented Interfaces:
HasDescription
,CanOverrideDescription<ArchRule>
,ArchRule
,CanBeEvaluated
- Enclosing class:
- Architectures
public static final class Architectures.LayeredArchitecture extends java.lang.Object implements ArchRule
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Architectures.LayeredArchitecture.LayerDefinition
class
Architectures.LayeredArchitecture.LayerDependencySpecification
Nested classes/interfaces inherited from interface com.tngtech.archunit.lang.ArchRule
ArchRule.Assertions, ArchRule.Factory, ArchRule.Transformation
-
Method Summary
Modifier and Type Method Description Architectures.LayeredArchitecture
as(java.lang.String newDescription)
Allows to adjust the description of this object.ArchRule
because(java.lang.String reason)
void
check(JavaClasses classes)
EvaluationResult
evaluate(JavaClasses classes)
java.lang.String
getDescription()
Architectures.LayeredArchitecture
ignoreDependency(DescribedPredicate<? super JavaClass> origin, DescribedPredicate<? super JavaClass> target)
Architectures.LayeredArchitecture
ignoreDependency(java.lang.Class<?> origin, java.lang.Class<?> target)
Architectures.LayeredArchitecture
ignoreDependency(java.lang.String origin, java.lang.String target)
Architectures.LayeredArchitecture.LayerDefinition
layer(java.lang.String name)
Starts the definition of a new layer within the currentLayeredArchitecture
.Architectures.LayeredArchitecture.LayerDefinition
optionalLayer(java.lang.String name)
Starts the definition of a new optional layer within the currentLayeredArchitecture
.java.lang.String
toString()
Architectures.LayeredArchitecture.LayerDependencySpecification
whereLayer(java.lang.String name)
Architectures.LayeredArchitecture
withOptionalLayers(boolean optionalLayers)
By default, layers defined withlayer(String)
must not be empty, i.e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Method Details
-
withOptionalLayers
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture withOptionalLayers(boolean optionalLayers)By default, layers defined withlayer(String)
must not be empty, i.e. contain at least one class.
withOptionalLayers(true)
can be used to make all layers optional.
withOptionalLayers(false)
still allows to define individual optional layers withoptionalLayer(String)
.- See Also:
optionalLayer(String)
-
layer
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture.LayerDefinition layer(java.lang.String name)Starts the definition of a new layer within the currentLayeredArchitecture
.
UnlesswithOptionalLayers(true
} is used, this layer must not be empty.- See Also:
optionalLayer(String)
-
optionalLayer
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture.LayerDefinition optionalLayer(java.lang.String name)Starts the definition of a new optional layer within the currentLayeredArchitecture
.
An optional layer will not fail if it is empty, i.e. does not contain any classes. WhenwithOptionalLayers(true)
is used, all layers are optional by default, such that there is no difference betweenoptionalLayer(String)
andlayer(String)
anymore -
getDescription
- Specified by:
getDescription
in interfaceHasDescription
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
evaluate
- Specified by:
evaluate
in interfaceCanBeEvaluated
-
check
-
because
-
as
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture as(java.lang.String newDescription)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
-
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture ignoreDependency(java.lang.Class<?> origin, java.lang.Class<?> target) -
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture ignoreDependency(java.lang.String origin, java.lang.String target) -
ignoreDependency
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture ignoreDependency(DescribedPredicate<? super JavaClass> origin, DescribedPredicate<? super JavaClass> target) -
whereLayer
@PublicAPI(usage=ACCESS) public Architectures.LayeredArchitecture.LayerDependencySpecification whereLayer(java.lang.String name)
-