Package com.github.packageurl
Class PackageURLBuilder
java.lang.Object
com.github.packageurl.PackageURLBuilder
A builder construct for Package-URL objects.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PackageURLBuilderObtain a reference to a new builder object.build()Builds the new PackageURL object.getName()Returns current name value set in the builder.Returns current namespace value set in the builder.getQualifier(String key) Returns a currently set qualifier value set in the builder for the specified key.Returns sorted map containing all qualifiers set in this builder.Returns current subpath value set in the builder.getType()Returns current type value set in the builder.Returns current version value set in the builder.Adds the package name.withNamespace(String namespace) Adds the package namespace.Removes all qualifiers, if any.withoutQualifier(String key) Removes a package qualifier.withQualifier(String key, String value) Adds a package qualifier.withSubpath(String subpath) Adds the package subpath.Adds the package URL type.withVersion(String version) Adds the package version.
-
Field Details
-
type
-
namespace
-
name
-
version
-
subpath
-
qualifiers
-
-
Constructor Details
-
PackageURLBuilder
private PackageURLBuilder()
-
-
Method Details
-
aPackageURL
Obtain a reference to a new builder object.- Returns:
- a new builder object.
-
withType
Adds the package URL type.- Parameters:
type- the package type- Returns:
- a reference to the builder
- See Also:
-
withNamespace
Adds the package namespace.- Parameters:
namespace- the package namespace- Returns:
- a reference to the builder
- See Also:
-
withName
Adds the package name.- Parameters:
name- the package name- Returns:
- a reference to the builder
- See Also:
-
withVersion
Adds the package version.- Parameters:
version- the package version- Returns:
- a reference to the builder
- See Also:
-
withSubpath
Adds the package subpath.- Parameters:
subpath- the package subpath- Returns:
- a reference to the builder
- See Also:
-
withQualifier
Adds a package qualifier.- Parameters:
key- the package qualifier keyvalue- the package qualifier value- Returns:
- a reference to the builder
- See Also:
-
withoutQualifier
Removes a package qualifier. This is a no-op if the qualifier is not present.- Parameters:
key- the package qualifier key to remove- Returns:
- a reference to the builder
-
withNoQualifiers
Removes all qualifiers, if any.- Returns:
- a reference to this builder.
-
getType
Returns current type value set in the builder.- Returns:
- type set in this builder
-
getNamespace
Returns current namespace value set in the builder.- Returns:
- namespace set in this builder
-
getName
Returns current name value set in the builder.- Returns:
- name set in this builder
-
getVersion
Returns current version value set in the builder.- Returns:
- version set in this builder
-
getSubpath
Returns current subpath value set in the builder.- Returns:
- subpath set in this builder
-
getQualifiers
Returns sorted map containing all qualifiers set in this builder. An empty map is returned if no qualifiers is set.- Returns:
- all qualifiers set in this builder, or an empty map if none are set.
-
getQualifier
Returns a currently set qualifier value set in the builder for the specified key.- Parameters:
key- qualifier key- Returns:
- qualifier value or
nullif one is not set.
-
build
Builds the new PackageURL object.- Returns:
- the new PackageURL object
- Throws:
MalformedPackageURLException- thrown if the type or name has not been specified or if a field fails validation
-