Package io.quarkus.sbom
Class ComponentDescriptor.Builder
java.lang.Object
io.quarkus.sbom.ComponentDescriptor
io.quarkus.sbom.ComponentDescriptor.Builder
- Enclosing class:
ComponentDescriptor
Builder for constructing ComponentDescriptor instances.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.quarkus.sbom.ComponentDescriptor
ComponentDescriptor.Builder -
Field Summary
Fields inherited from class io.quarkus.sbom.ComponentDescriptor
bomRef, components, description, distributionPath, integrity, licenses, path, pedigree, purl, scope, SCOPE_DEVELOPMENT, SCOPE_RUNTIME, topLevel -
Constructor Summary
ConstructorsConstructorDescriptionBuilder(ComponentDescriptor component) Creates a builder initialized with values from an existing ComponentDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionaddComponent(ComponentDescriptor component) Adds a nested (bundled) component to this component.addLicense(LicenseInfo license) Adds a license to this component.build()Builds an immutable ComponentDescriptor from this builder.protected ComponentDescriptorSets an explicit bom-ref for this component.setDescription(String description) Sets the package description.Convenience method to set the scope to development.setDistributionPath(String distributionPath) Sets the distribution path (relative location within the application distribution).setIntegrity(String integrity) Sets the integrity hash.setLicenses(List<LicenseInfo> licenses) Sets the licenses for this component, replacing any previously set licenses.Sets the file system path to the component artifact.setPedigree(String pedigree) Sets the pedigree notes describing component modifications.Sets the Package URL identifying this component.Sets the dependency scope.setTopLevel(boolean topLevel) Sets whether this component is a top-level (direct) dependency of the main application component.Methods inherited from class io.quarkus.sbom.ComponentDescriptor
builder, getBomRef, getComponents, getDescription, getDistributionPath, getIntegrity, getLicenses, getName, getNamespace, getPath, getPedigree, getPurl, getScope, getType, getVersion, isTopLevel
-
Constructor Details
-
Builder
Creates a builder initialized with values from an existing ComponentDescriptor.- Parameters:
component- the component to copy values from
-
-
Method Details
-
setPurl
Sets the Package URL identifying this component.- Parameters:
purl- the Package URL- Returns:
- this builder
-
setBomRef
Sets an explicit bom-ref for this component. If not set, defaults topurl.toString().- Parameters:
bomRef- the bom-ref string- Returns:
- this builder
-
setIntegrity
Sets the integrity hash.This is typically an SRI hash from lock files (e.g., "sha512-abc123...").
- Parameters:
integrity- the SRI hash, or null- Returns:
- this builder
-
setDescription
Sets the package description.- Parameters:
description- a human-readable description, or null- Returns:
- this builder
-
setScope
Sets the dependency scope.Common values are
ComponentDescriptor.SCOPE_RUNTIMEandComponentDescriptor.SCOPE_DEVELOPMENT.- Parameters:
scope- the dependency scope, or null- Returns:
- this builder
-
setDevelopmentScope
Convenience method to set the scope to development.- Returns:
- this builder
-
setPath
Sets the file system path to the component artifact. Used for file hash computation in SBOM generators.- Parameters:
path- the file path, or null- Returns:
- this builder
-
setDistributionPath
Sets the distribution path (relative location within the application distribution). Used for evidence/occurrence tracking in SBOM generators.- Parameters:
distributionPath- the distribution path, or null- Returns:
- this builder
-
setPedigree
Sets the pedigree notes describing component modifications.- Parameters:
pedigree- the pedigree notes, or null- Returns:
- this builder
-
setTopLevel
Sets whether this component is a top-level (direct) dependency of the main application component.Extensions should set this to
truefor components that represent direct project dependencies (e.g., packages declared inpackage.jsonrather than transitive dependencies).- Parameters:
topLevel-trueif this is a top-level dependency- Returns:
- this builder
-
setLicenses
Sets the licenses for this component, replacing any previously set licenses.- Parameters:
licenses- the list of license information entries- Returns:
- this builder
-
addLicense
Adds a license to this component.- Parameters:
license- the license information to add- Returns:
- this builder
-
addComponent
Adds a nested (bundled) component to this component.- Parameters:
component- the nested component descriptor- Returns:
- this builder
-
build
Builds an immutable ComponentDescriptor from this builder.- Returns:
- a new immutable ComponentDescriptor instance
-
ensureImmutable
- Overrides:
ensureImmutablein classComponentDescriptor
-