1 package org.kuali.common.jute.project.maven;
2
3 import static org.kuali.common.jute.base.Precondition.checkNotBlank;
4
5 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
6
7 @JsonDeserialize(builder = Exclusion.Builder.class)
8 public final class Exclusion {
9
10 private final String groupId;
11 private final String artifactId;
12
13 private Exclusion(Builder builder) {
14 this.groupId = builder.groupId;
15 this.artifactId = builder.artifactId;
16 }
17
18 public static Exclusion build(String groupId, String artifactId) {
19 return builder().withGroupId(groupId).withArtifactId(artifactId).build();
20 }
21
22 public static Builder builder() {
23 return new Builder();
24 }
25
26 public static class Builder implements org.apache.commons.lang3.builder.Builder<Exclusion> {
27
28 private String groupId;
29 private String artifactId;
30
31 public Builder withGroupId(String groupId) {
32 this.groupId = groupId;
33 return this;
34 }
35
36 public Builder withArtifactId(String artifactId) {
37 this.artifactId = artifactId;
38 return this;
39 }
40
41 @Override
42 public Exclusion build() {
43 return validate(new Exclusion(this));
44 }
45
46 public static Exclusion validate(Exclusion instance) {
47 checkNotBlank(instance.groupId, "groupId");
48 checkNotBlank(instance.artifactId, "artifactId");
49 return instance;
50 }
51 }
52
53 public String getGroupId() {
54 return groupId;
55 }
56
57 public String getArtifactId() {
58 return artifactId;
59 }
60
61 }