Class ComponentDescriptor
- Direct Known Subclasses:
ComponentDescriptor.Builder
Component identity is represented by a Purl (Package URL), which encapsulates the
ecosystem type, namespace, name, and version. Each component has a bomRef that
uniquely identifies it within the SBOM (defaults to the PURL string).
Additional metadata includes:
- Integrity hash: SRI-format hash from lock files for verification
- Scope: runtime or development dependency classification
- Description: human-readable component description
- Licenses: one or more
LicenseInfoentries describing applicable licenses
Dependencies are not stored on the component itself. Use ComponentDependencies
to represent the dependency graph separately, referencing components by their bom-ref.
This class follows the builder pattern. Instances are immutable and constructed via the ComponentDescriptor.Builder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing ComponentDescriptor instances. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentDescriptor.Builderbuilder()Creates a new builder for constructing a ComponentDescriptor.protected ComponentDescriptorGets the bom-ref that uniquely identifies this component within the SBOM.Gets nested (bundled) components contained within this component.Gets the package description.Gets the distribution path (relative location within the application distribution).Gets the integrity hash.Gets the licenses associated with this component.getName()Gets the package name.Gets the namespace (PURL namespace field).getPath()Gets the file system path to the component artifact.Gets the pedigree notes describing component modifications.getPurl()Gets the Package URL identifying this component.getScope()Gets the dependency scope.getType()Gets the package type (PURL type field).Gets the resolved version.booleanReturns whether this component is a top-level (direct) dependency of the main application component.
-
Field Details
-
SCOPE_RUNTIME
- See Also:
-
SCOPE_DEVELOPMENT
- See Also:
-
purl
-
bomRef
-
integrity
-
description
-
scope
-
path
-
distributionPath
-
pedigree
-
topLevel
protected boolean topLevel -
licenses
-
components
-
-
Method Details
-
builder
Creates a new builder for constructing a ComponentDescriptor.- Returns:
- a new builder instance
-
getPurl
Gets the Package URL identifying this component.- Returns:
- the Package URL
-
getBomRef
Gets the bom-ref that uniquely identifies this component within the SBOM. Defaults to the PURL string.- Returns:
- the bom-ref
-
getType
Gets the package type (PURL type field).Examples: "npm", "pypi", "maven", "cargo"
- Returns:
- the package type
-
getNamespace
Gets the namespace (PURL namespace field).For npm, this is the scope (e.g., "@babel"). For Maven, this is the groupId.
- Returns:
- the package namespace, or null
-
getName
Gets the package name.- Returns:
- the package name
-
getVersion
Gets the resolved version.- Returns:
- the package version, or null if not resolved
-
getIntegrity
Gets the integrity hash.This is typically an SRI hash from lock files (e.g., "sha512-abc123...").
- Returns:
- the SRI hash, or null
-
getDescription
Gets the package description.- Returns:
- a human-readable description, or null
-
getScope
Gets the dependency scope.Common values are
SCOPE_RUNTIMEandSCOPE_DEVELOPMENT.- Returns:
- the dependency scope, or null
-
getPath
Gets the file system path to the component artifact.- Returns:
- the file path, or null
-
getDistributionPath
Gets the distribution path (relative location within the application distribution).- Returns:
- the distribution path, or null
-
getPedigree
Gets the pedigree notes describing component modifications.- Returns:
- the pedigree notes, or null
-
isTopLevel
public boolean isTopLevel()Returns whether this component is a top-level (direct) dependency of the main application component.Top-level components appear as direct dependency edges from the main application component in the generated SBOM. Components that are transitive dependencies should not be marked as top-level.
- Returns:
trueif this is a top-level dependency
-
getLicenses
Gets the licenses associated with this component.- Returns:
- an unmodifiable list of license information entries, empty if none
-
getComponents
Gets nested (bundled) components contained within this component.These represent artifacts that have been shaded or bundled into this component's JAR, detected by the presence of additional
META-INF/maven/.../pom.propertiesentries.- Returns:
- an unmodifiable list of nested component descriptors, empty if none
-
ensureImmutable
-