public class FullProjectInfo extends BaseProjectInfo implements HasMetricsNode, CoverageDataReceptor, ProjectInfo
A model of a java project. The model is built at instrumentation time and can then be queried to generate reports.
The project model is updated via the various add*() methods. The project must be versioned using
setVersion() at the start of each instrumentation session. @see Clover2Registry.
The main entry points to project hierachy are the getPackages(), getPackages(HasMetricsFilter) methods,
which return arrays of FullPackageInfos for the project.
Several convenience methods are provided to enable fast lookup of entities in the project, using lazily built data structures:
getPackageRoots() returns a tree of PackageFragments representing the (possibly) non-concrete
packages in the project.findClass() finds a ClassInfo in the project given its fully qualified name.hasTestHits(HasMetricsNode), getTestHits(HasMetricsNode), and getTestMethod(int) gets information on
which tests hit a given entity in the project.
Metrics for the project are available via getMetrics(). Note that the returned BlockMetrics
should be cast to a ProjectMetrics to access project-level metrics. Before querying coverage related metrics on
the project or its children, you must set a CoverageDataProvider (otherwise all coverage-related
metrics will return 0).
A call to setDataProvider() forces metrics for the project and all children to be lazily
recalculated.
Note: The setComparator() method only affects the order of project elements returned via the
HasMetricsNode interface
Note: The serialized version of this class is used in the stored version of the Clover2Registry.
Care must be taken when adding non-transient fields to this class, because they could potentially break
compatibility with existing registry files.
classLookup, contextFilter, fileLookup, metrics, name, packages, rawMetrics, version| Constructor and Description |
|---|
FullProjectInfo(String name) |
FullProjectInfo(String name,
long version) |
addPackage, findClass, findFile, getAllPackages, getClasses, getContextFilter, getDefaultPackage, getFiles, getName, getNamedPackage, getPackages, getVersion, isEmpty, setContextFilter, setMetrics, setName, visit, visitFilesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisEmptyfindClass, findFile, getName, isEmptyvisitgetAllPackagesgetContextFiltersetMetricspublic FullProjectInfo(String name, long version)
public FullProjectInfo(String name)
public PackageFragment[] getPackageRoots()
public FullProjectInfo copy()
public FullProjectInfo copy(HasMetricsFilter filter)
public FullProjectInfo copy(HasMetricsFilter filter, ContextSet contextFilter)
public void resolve(Path sourcePath)
public void setDataProvider(CoverageDataProvider data)
setDataProvider in interface CoverageDataReceptorpublic CoverageDataProvider getDataProvider()
getDataProvider in interface CoverageDataReceptorpublic int getDataIndex()
getDataIndex in interface CoverageDataRangepublic int getDataLength()
getDataLength in interface CoverageDataRangepublic void setDataLength(int length)
public void buildCaches()
public boolean isFragmented()
public void setFragmented(boolean fragmented)
public String getChildType()
getChildType in interface HasMetricsNodepublic int getNumChildren()
getNumChildren in interface HasMetricsNodepublic HasMetricsNode getChild(int i)
getChild in interface HasMetricsNodepublic int getIndexOfChild(HasMetricsNode child)
getIndexOfChild in interface HasMetricsNodepublic boolean isLeaf()
isLeaf in interface HasMetricsNodepublic void setComparator(Comparator cmp)
setComparator in interface HasMetricsNodepublic void setVersion(long version)
setVersion in class BaseProjectInfopublic BlockMetrics getMetrics()
getMetrics in interface HasMetricsgetMetrics in class BaseProjectInfopublic BlockMetrics getRawMetrics()
getRawMetrics in interface HasMetricsgetRawMetrics in class BaseProjectInfopublic boolean hasTestResults()
public void setHasTestResults(boolean hasTestResults)
public PackageFragment findPackageFragment(String packageName)
public void invalidateCaches()
invalidateCaches in interface CachingInfoinvalidateCaches in class BaseProjectInfopublic PackageInfo findPackage(String name)
HasPackagesfindPackage in interface HasPackagesfindPackage in class BaseProjectInfoname - fully qualified package namenullCopyright © 2024 OpenClover.org. All rights reserved.