Class Slice
- All Implemented Interfaces:
HasDescription,CanOverrideDescription<Slice>,Iterable<JavaClass>,Collection<JavaClass>,Set<JavaClass>
@PublicAPI(usage=ACCESS)
public final class Slice
extends ForwardingSet<JavaClass>
implements HasDescription, CanOverrideDescription<Slice>
A collection of
Thus there could be a slice 'Order' housing all the classes from the
JavaClasses modelling some domain aspect of a code basis. This is conceptually
a cut through a code base according to business logic. Take for example
com.mycompany.myapp.order
com.mycompany.myapp.customer
com.mycompany.myapp.user
com.mycompany.myapp.authorization
The top level packages under 'myapp' could be considered slices according to different domain aspects.Thus there could be a slice 'Order' housing all the classes from the
order package, a slice 'Customer'
housing all the classes from the customer package and so on.-
Method Summary
Modifier and TypeMethodDescriptionThe pattern can be a description with references to the matching groups by '$' and position.delegate()booleangetNamePart(int index) Returns a matching part of this slice.inthashCode()toString()Methods inherited from class com.tngtech.archunit.base.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Method Details
-
delegate
- Specified by:
delegatein classForwardingSet<JavaClass>
-
getDescription
- Specified by:
getDescriptionin interfaceHasDescription
-
as
The pattern can be a description with references to the matching groups by '$' and position. E.g. slices are created by 'some.svc.(*).sub.(*)', and the pattern is "the module $2 of service $1", and we match 'some.svc.foo.module.bar', then the resulting description will be "the module bar of service foo".- Specified by:
asin interfaceCanOverrideDescription<Slice>- Parameters:
pattern- The description pattern with numbered references of the form $i- Returns:
- Same slice with different description
-
getDependenciesFromSelf
-
getDependenciesToSelf
-
getNamePart
Returns a matching part of this slice. E.g. if the slice was created by matching '..(*).controller.(*)..', against 'some.other.controller.here.more', then name part '1' would be 'other' and name part '2' would be 'here'.- Parameters:
index- The index of the matched group- Returns:
- The part of the matched package name.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<JavaClass>- Specified by:
hashCodein interfaceSet<JavaClass>- Overrides:
hashCodein classForwardingCollection<JavaClass>
-
equals
- Specified by:
equalsin interfaceCollection<JavaClass>- Specified by:
equalsin interfaceSet<JavaClass>- Overrides:
equalsin classForwardingCollection<JavaClass>
-
toString
- Overrides:
toStringin classForwardingCollection<JavaClass>
-