Class MetricsComponent<T>

java.lang.Object
com.tngtech.archunit.base.ForwardingCollection<T>
com.tngtech.archunit.library.metrics.MetricsComponent<T>
Type Parameters:
T - The type of the elements this component contains, e.g. JavaClass
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Collection<T>

@PublicAPI(usage=ACCESS)
public final class MetricsComponent<T>
extends ForwardingCollection<T>
Represents a component of the software system. The term "component" does not impose any wider restriction than that it contains a set of elements which all share a common string identifier.
Thus by definition two components are equal, if and only if they have the same identifier.
The elements that a component contains are principally completely free. It could be JavaClasses or JavaPackages, but also any other type of objects where software metrics can be calculated on. Specific metrics might then impose type restrictions on the element, e.g. if metrics can only be calculated for elements that specify their dependencies on other elements.
This abstraction is powerful enough to be applied to a wide variety of scenarios. For example
  • Partitioning classes by their packages and using the package name as identifier would create one component per package
  • Using the (unique) name of a build module and grouping all classes in that module
  • Partitioning classes by their fully qualified class name would create one component per class
  • Partitioning methods by their declaring class name would create components each containing exactly the methods of one specific class