Class ArchModules.Creator
java.lang.Object
com.tngtech.archunit.library.modules.ArchModules.Creator
- Direct Known Subclasses:
ArchModules.CreatorByRootClass
- Enclosing class:
- ArchModules<DESCRIPTOR extends ArchModule.Descriptor>
An element of the fluent API to create
ArchModules-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn element of the fluent API to createArchModules -
Method Summary
Modifier and TypeMethodDescriptionderiveNameFromPattern(String namingPattern) Allows to customize eachArchModulenameby specifying a string pattern that defines how to derive the name from theArchModule.Identifier.
In particular, the passednamingPatternmay contain numbered placeholders like${1}to refer to parts from theArchModule.Identifier.describeBy(ArchModules.DescriptorCreator<D> descriptorCreator) Allows to fully customize theArchModule.Descriptorof the createdArchModules.ArchModules<?>modularize(JavaClasses classes)
-
Method Details
-
deriveNameFromPattern
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public ArchModules.Creator deriveNameFromPattern(String namingPattern) Allows to customize eachArchModulenameby specifying a string pattern that defines how to derive the name from theArchModule.Identifier.
In particular, the passednamingPatternmay contain numbered placeholders like${1}to refer to parts from theArchModule.Identifier. It may also contain the special placeholder$@to refer to the colon-joined form of the identifier.
Suppose theArchModule.Identifieris["customer", "creation"], then the name could be derived as
Note that the derived name must be unique between all"Module[${1}/${2}]" -> would yield the name "Module[customer/creation]" "Module[$@] -> would yield the name "Module[customer:creation]"modules.- Parameters:
namingPattern- A string naming pattern deriving theArchModulenamefrom theArchModule.Identifier- Returns:
- A fluent API to further customize how to create
ArchModules
-
describeBy
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public <D extends ArchModule.Descriptor> ArchModules.Creator.WithGenericDescriptor<D> describeBy(ArchModules.DescriptorCreator<D> descriptorCreator) Allows to fully customize theArchModule.Descriptorof the createdArchModules. This allows to pass on meta-data from the contained classes additionally to any derivedmodule name.- Type Parameters:
D- The specific subtype of theArchModule.Descriptorto create- Parameters:
descriptorCreator- A generic function specifying how to create theArchModule.Descriptor- Returns:
- A fluent API to further customize how to create
ArchModules
-
modularize
-