@@ -43,14 +43,35 @@ private PackageURLBuilder() {
4343 }
4444
4545 /**
46- * Obtain a reference to a new builder object.
46+ * Obtains a reference to a new builder object.
4747 *
48- * @return a new builder object.
48+ * @return a new builder object
4949 */
5050 public static PackageURLBuilder aPackageURL () {
5151 return new PackageURLBuilder ();
5252 }
5353
54+ /**
55+ * Obtains a reference to a new builder object initialized with the existing {@link PackageURL} object.
56+ *
57+ * @param packageURL the existing Package URL object
58+ * @return a new builder object
59+ */
60+ public static PackageURLBuilder aPackageURL (final PackageURL packageURL ) {
61+ return packageURL .toBuilder ();
62+ }
63+
64+ /**
65+ * Obtain a reference to a new builder object initialized with the existing Package URL string.
66+ *
67+ * @param purl the existing Package URL string
68+ * @return a new builder object
69+ * @throws MalformedPackageURLException if an error occurs while parsing the input
70+ */
71+ public static PackageURLBuilder aPackageURL (final String purl ) throws MalformedPackageURLException {
72+ return new PackageURL (purl ).toBuilder ();
73+ }
74+
5475 /**
5576 * Adds the package URL type.
5677 *
@@ -150,6 +171,7 @@ public PackageURLBuilder withQualifiers(final Map<String, String> qualifiers) {
150171
151172 /**
152173 * Removes a package qualifier. This is a no-op if the qualifier is not present.
174+ *
153175 * @param key the package qualifier key to remove
154176 * @return a reference to the builder
155177 */
@@ -190,6 +212,7 @@ public PackageURLBuilder withoutQualifiers() {
190212
191213 /**
192214 * Removes all qualifiers, if any.
215+ *
193216 * @return a reference to this builder.
194217 */
195218 public PackageURLBuilder withNoQualifiers () {
@@ -199,6 +222,7 @@ public PackageURLBuilder withNoQualifiers() {
199222
200223 /**
201224 * Returns current type value set in the builder.
225+ *
202226 * @return type set in this builder
203227 */
204228 public String getType () {
@@ -207,6 +231,7 @@ public String getType() {
207231
208232 /**
209233 * Returns current namespace value set in the builder.
234+ *
210235 * @return namespace set in this builder
211236 */
212237 public String getNamespace () {
@@ -215,6 +240,7 @@ public String getNamespace() {
215240
216241 /**
217242 * Returns current name value set in the builder.
243+ *
218244 * @return name set in this builder
219245 */
220246 public String getName () {
@@ -223,6 +249,7 @@ public String getName() {
223249
224250 /**
225251 * Returns current version value set in the builder.
252+ *
226253 * @return version set in this builder
227254 */
228255 public String getVersion () {
@@ -231,6 +258,7 @@ public String getVersion() {
231258
232259 /**
233260 * Returns current subpath value set in the builder.
261+ *
234262 * @return subpath set in this builder
235263 */
236264 public String getSubpath () {
@@ -239,8 +267,9 @@ public String getSubpath() {
239267
240268 /**
241269 * Returns sorted map containing all qualifiers set in this builder.
242- * An empty map is returned if no qualifiers is set.
243- * @return all qualifiers set in this builder, or an empty map if none are set.
270+ * An empty map is returned if no qualifiers are set
271+ *
272+ * @return all qualifiers set in this builder, or an empty map if none are set
244273 */
245274 public Map <String , String > getQualifiers () {
246275 if (qualifiers == null ) {
@@ -251,8 +280,9 @@ public Map<String, String> getQualifiers() {
251280
252281 /**
253282 * Returns a currently set qualifier value set in the builder for the specified key.
283+ *s
254284 * @param key qualifier key
255- * @return qualifier value or {@code null} if one is not set.
285+ * @return qualifier value or {@code null} if one is not set
256286 */
257287 public String getQualifier (String key ) {
258288 if (qualifiers == null ) {
0 commit comments