@NotThreadSafe
public class JavaMetrics
extends java.lang.Object
In addition to the metrics grouped by package, an instance also contains metrics for any modular compilation units in the code base.
Instances of this class are not safe for use by multiple threads without external synchronization.
| Constructor | Description |
|---|---|
JavaMetrics() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(ModularCompilationUnitMetrics pMetrics) |
Add metrics for a modular compilation unit to this instance.
|
java.lang.Iterable<ModularCompilationUnitMetrics> |
getModularCompilationUnits() |
Get an
Iterable that iterates over the modular compilation unit metrics that have
been collected in this instance. |
int |
getNumModularCompilationUnits() |
Get the number of modular compilation units for which metrics have been collected in this
instance.
|
int |
getNumPackages() |
Get the number of packages for which metrics have been collected in this instance.
|
java.lang.Iterable<PackageMetrics> |
getPackages() |
Get an
Iterable that iterates over the package metrics that have been collected in
this instance. |
boolean |
isEmpty() |
Is this instance empty?
|
PackageMetrics |
maybeCreate(java.lang.String pPackageName) |
Get the
PackageMetrics for a package with a specific name. |
public boolean isEmpty()
public int getNumPackages()
@Nonnull public java.lang.Iterable<PackageMetrics> getPackages()
Iterable that iterates over the package metrics that have been collected in
this instance.Iterable for the package metrics, never null.public int getNumModularCompilationUnits()
@Nonnull public java.lang.Iterable<ModularCompilationUnitMetrics> getModularCompilationUnits()
Iterable that iterates over the modular compilation unit metrics that have
been collected in this instance.Iterable for the modular compilation unit metrics, never null.@Nonnull public PackageMetrics maybeCreate(@Nonnull java.lang.String pPackageName)
PackageMetrics for a package with a specific name. If no package metrics with
the specified name exists in this instance, a new PackageMetrics will be created and
returned.
This method returns the same PackageMetrics instance when called repeatedly with the
same package name.
pPackageName - The name of the package to get the PackageMetrics for. The
default package is represented by an empty string.PackageMetrics instance for the specified package name, never null.public void add(@Nonnull
ModularCompilationUnitMetrics pMetrics)
pMetrics - The modular compilation unit metrics.java.lang.NullPointerException - if pMetrics is null.