@@ -45,6 +45,28 @@ public record Artifact(String artifactId, String name, String description, List<
4545 }
4646 }
4747
48+ /**
49+ * Create a new Builder
50+ *
51+ * @return the builder
52+ */
53+ public static Builder builder () {
54+ return new Builder ();
55+ }
56+
57+ /**
58+ * Create a new Builder initialized with values from an existing Artifact.
59+ * <p>
60+ * This builder creates defensive copies of mutable collections to ensure
61+ * that modifications to the builder do not affect the original Artifact.
62+ *
63+ * @param artifact the Artifact to copy values from
64+ * @return the builder
65+ */
66+ public static Builder builder (Artifact artifact ) {
67+ return new Builder (artifact );
68+ }
69+
4870 /**
4971 * Builder for constructing immutable {@link Artifact} instances.
5072 * <p>
@@ -53,7 +75,7 @@ public record Artifact(String artifactId, String name, String description, List<
5375 * <p>
5476 * Example usage:
5577 * <pre>{@code
56- * Artifact result = new Artifact.Builder ()
78+ * Artifact result = Artifact.builder ()
5779 * .artifactId("artifact-123")
5880 * .name("Analysis Report")
5981 * .description("Detailed analysis of user data")
@@ -72,15 +94,15 @@ public static class Builder {
7294 /**
7395 * Creates a new Builder with all fields unset.
7496 */
75- public Builder (){
97+ private Builder (){
7698 }
7799
78100 /**
79101 * Creates a new Builder initialized with values from an existing Artifact.
80102 *
81103 * @param existingArtifact the Artifact to copy values from
82104 */
83- public Builder (Artifact existingArtifact ) {
105+ private Builder (Artifact existingArtifact ) {
84106 artifactId = existingArtifact .artifactId ;
85107 name = existingArtifact .name ;
86108 description = existingArtifact .description ;
0 commit comments